Hey there,
I still see inconsistent results with the stock .clear appium method on android - clear does not always clear the text field all the way.
I am using 1.4.8 (i'm updating soon) and my teammate is up to date with 1.4.10.
I essentially solved this by using the Mar 3 post that Abhishek_Gupta wrote, with the addition of pressing the android keycode to reach the end of the field. Here's what I have. It seems to work with one or multi line textfields, spaces and no spaces. I haven't tried this using any localized text.
#I work at blackboard so bb makes sure I don't get confused
def bb_clear(my_element)
system("adb shell input keyevent 123") #puts the cursor at the end of the text field
for i in 1..my_element.text.length
system("adb shell input keyevent KEYCODE_DEL")
end
end
Here's my ruby version info and my Gemfile info:
10:09 $ ruby --version
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
10:14 $ more Gemfile
source 'https://www.rubygems.org'
gem 'appium_lib', '~> 7.0.0'
gem 'rest-client', '~> 1.6.7'
gem 'rspec', '~> 2.14.1'
gem 'cucumber', '~> 1.3.15'
gem 'rspec-expectations', '~> 2.14.5'
gem 'spec', '~> 5.3.4'
gem 'sauce_whisk', '~> 0.0.13'
gem 'test-unit', '~> 2.5.5' # required for bundle exec ruby xunit_android.rb
gem 'nokogiri', '~> 1.6.6'
gem 'awesome_print', '~> 1.6'
gem 'json', '~> 1.8'
gem 'selenium-webdriver', '~> 2.45'
gem 'toml', '~> 0.0'
gem 'rake-hooks', '~>1.2.3'
gem 'eyes_selenium', '~> 2.23.0'
Hope this is helpful.
Thanks,
Eric