0

clear_text doesn't work for me when testing a webview. Does anyone know of a different method for webview/cordova apps? The locator I'm using is "webView css:'input#username'" but that seems to be fine as enter_text is working.

Any suggestions?

Thanks, Lewis.

Lewis
  • 59
  • 1
  • 1
  • 7

3 Answers3

1

Thanks but set_text("webView css:'input#username'", "") didn't work. I ended up using the solution you mentioned here

Thanks.

carmine
  • 1,597
  • 2
  • 24
  • 33
Lewis
  • 59
  • 1
  • 1
  • 7
0
set_text("webView css:'input#username'", "")

You might also try using the WebView JavaScript API

jmoody
  • 2,480
  • 1
  • 16
  • 22
0

When I had a similar problem, I ended up using something like this :

Then /^I clear a field with "([^\"]*)" text$/ do |name|
   name = set_value name
   element = query("UITextFieldLabel text: '#{name}'")[0]
   touch(element)
   wait_for_keyboard
   name.to_s.split('').each do |c|
      keyboard_enter_char 'Delete'
   end
end

Details are in here: Clear field with calabash-ios

Scimus
  • 1
  • 2