info: [debug] Pushing command to appium work queue: "au.getElement('7').setValueByType('[email protected]')"
info: [debug] Sending command to instruments: au.getElement('7').setValueByType('[email protected]')
info: [debug] [INST] 2014-10-01 01:53:29 +0000 Debug: Got new command 13 from instruments: au.getElement('7').
setValueByType('[email protected]')
info: [debug] [INST] 2014-10-01 01:53:29 +0000 Debug: evaluating au.getElement('7').setValueByType(
'[email protected]')
info: [debug] [INST] 2014-10-01 01:53:29 +0000 Debug: target.frontMostApp().keyboard().typeString("a")
info: [debug] [INST] 2014-10-01 01:53:29 +0000 Debug: target.frontMostApp().keyboard() failed to tap 'a'
info: [debug] [INST] 2014-10-01 01:53:29 +0000 Debug: Error typing 'a': VerboseError: target.frontMostApp().keyboard
() failed to tap 'a'
info: [debug] [INST] 2014-10-01 01:53:29 +0000 Debug: Retrying...
info: [debug] [INST] 2014-10-01 01:53:29 +0000 Debug: target.frontMostApp().keyboard().typeString("a")
info: [debug] [INST] 2014-10-01 01:53:29 +0000 Debug: target.frontMostApp().keyboard() failed to tap 'a'
I’m using Java, calling driver.findElement(MobileBy.className("UIATextField")).sendKeys("[email protected]"). Is there a way to enter the entire string into the text field at once? Or does iOS have to enter one character at a time?
Thanks @AndyDee that pointed me right direction. But can anyone tell me how to send ENTER to the text field? send_keys would take ‘\n’ but not setValue
Enter is:
driver.findElement(By.xpath("/someXpath")).sendKeys("\n");
The purpose of .setValue() is to completely skip any keyboard interraction and override the object field’s value with whatever you give the arguments of the method.
Using both together on the other hand would look like:
post /element/6/value
{
:value => [
[0] “\n”
]
}
Selenium::WebDriver::Error::JavascriptError: target.frontMostApp().keyboard() failed to tap ’
’
from /Library/Ruby/Gems/2.0.0/gems/selenium-webdriver-2.43.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok’
appium log ( I am on ios8 branch Appium v1.3.0-beta1 (REV 314bb546d290beb264656d4c86f6dc8c646ed9bd))
info: ← POST /wd/hub/session/1ab2f220-939f-4cb6-a413-1b924359b6f6/element/6/value 500 1779.665 ms - 212
info: [debug] [INST] 2014-10-09 17:48:10 +0000 Error: VerboseError: target.frontMostApp().keyboard() failed to tap ’
’
info: [debug] [INST] 2014-10-09 17:48:10 +0000 Error: Error during eval: typeString@[native code]
sendKeysToActiveElement@file:///Users/smalugu/code/appium_ios8/0B7D5302-886E-4FE6-A352-A31F77FD1BAB/bootstrap-2c0b02acfaf99c28.js:1265:32
setValueByType@file:///Users/smalugu/code/appium_ios8/0B7D5302-886E-4FE6-A352-A31F77FD1BAB/bootstrap-2c0b02acfaf99c28.js:1955:38
eval code
eval@[native code]
startProcessing@file:///Users/smalugu/code/appium_ios8/0B7D5302-886E-4FE6-A352-A31F77FD1BAB/bootstrap-2c0b02acfaf99c28.js:2646:30
bootstrap@file:///Users/smalugu/code/appium_ios8/0B7D5302-886E-4FE6-A352-A31F77FD1BAB/bootstrap-2c0b02acfaf99c28.js:2712:31
global code@file:///Users/smalugu/code/appium_ios8/0B7D5302-886E-4FE6-A352-A31F77FD1BAB/bootstrap-2c0b02acfaf99c28.js:2721:10
info: [debug] [INST] 2014-10-09 17:48:10 +0000 Debug: responding with:
info: [debug] [INST] 2014-10-09 17:48:10 +0000 Debug: Running system command #18: /usr/local/Cellar/node/0.10.28/bin/node /Users/smalugu/code/appium_ios8/node_modules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{“status”:17,“value”:“target.frontMostApp().keyboard() failed to tap ‘\n’”}…
This worked on a simulator, i just pressed cmd+k the first time a text box showed up and it worked. I haven’t tried it on a device yet (but devices already popup a keyboard), so send_keys should work directly
Hi @AndyDee : i’m facing casting exception while using MobileElement
org.openqa.selenium.remote.RemoteWebElement cannot be cast to io.appium.java_client.MobileElement
Details on- MobileElement Class cast exception