sendKeys doesn't type email in google + email textbox

Hello guys,

Our native app has google + authentification.

So I’m trying to implement login test, but face a problem: sendKeys doesn’t work.
driver.findElementByXPath("//android.widget.EditText").sendKeys("[email protected]");

Appium log:
[36minfoe[39m: e[37m–>e[39m e[37mPOSTe[39m e[37m/wd/hub/session/c7f8b7cd-a458-4e51-ba34-39da37c18f38/elemente[39m e[90m{“using”:“xpath”,“value”:"//android.widget.EditText"}e[39m
e[36minfoe[39m: [debug] Waiting up to 0ms for condition
e[36minfoe[39m: [debug] Pushing command to appium work queue: [“find”,{“strategy”:“xpath”,“selector”:"//android.widget.EditText",“context”:"",“multiple”:false}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:"//android.widget.EditText",“context”:"",“multiple”:false}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: find
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Finding //android.widget.EditText using XPATH with the contextId: multiple: false
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.EditText, INSTANCE=0]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:{“ELEMENT”:“33”}}
e[36minfoe[39m: [debug] Responding to client with success: {“status”:0,“value”:{“ELEMENT”:“33”},“sessionId”:“c7f8b7cd-a458-4e51-ba34-39da37c18f38”}
e[36minfoe[39m: e[37m<-- POST /wd/hub/session/c7f8b7cd-a458-4e51-ba34-39da37c18f38/element e[39me[32m200e[39me[90m 117.728 ms - 88e[39m e[90m{“status”:0,“value”:{“ELEMENT”:“33”},“sessionId”:“c7f8b7cd-a458-4e51-ba34-39da37c18f38”}e[39m
e[36minfoe[39m: e[37m–>e[39m e[37mPOSTe[39m e[37m/wd/hub/session/c7f8b7cd-a458-4e51-ba34-39da37c18f38/element/33/valuee[39m e[90m{“id”:“33”,“value”:[“[email protected]”]}e[39m
e[36minfoe[39m: [debug] Pushing command to appium work queue: [“element:setText”,{“elementId”:“33”,“text”:“[email protected]”,“replace”:false}]
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“element:setText”,“params”:{“elementId”:“33”,“text”:“[email protected]”,“replace”:false}}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command action: setText
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Using element passed in.
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Attempting to clear using UiObject.clearText().
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:7,“value”:“UiSelector[CLASS=android.widget.EditText, INSTANCE=0]”}
e[36minfoe[39m: [debug] Responding to client with error: {“status”:7,“value”:{“message”:“An element could not be located on the page using the given search parameters.”,“origValue”:“UiSelector[CLASS=android.widget.EditText, INSTANCE=0]”},“sessionId”:“c7f8b7cd-a458-4e51-ba34-39da37c18f38”}
e[36minfoe[39m: e[37m<-- POST /wd/hub/session/c7f8b7cd-a458-4e51-ba34-39da37c18f38/element/33/value e[39me[31m500e[39me[90m 25274.415 ms - 232e[39m e[90me[39m
e[36minfoe[39m: e[37m–>e[39m e[37mDELETEe[39m e[37m/wd/hub/session/c7f8b7cd-a458-4e51-ba34-39da37c18f38e[39m e[90m{}e[39m
e[36minfoe[39m: Shutting down appium session
e[36minfoe[39m: [debug] Pressing the HOME button
e[36minfoe[39m: [debug] executing cmd: “C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe” -s 048a1d2909d38f8f shell “input keyevent 3”
e[36minfoe[39m: [debug] Stopping logcat capture
e[36minfoe[39m: [debug] Logcat terminated with code null, signal SIGTERM
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“shutdown”}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:0,“value”:“OK, shutting down”}
e[36minfoe[39m: [debug] [BOOTSTRAP] [debug] Closed client connection
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunnere[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServere[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrape[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0e[39m
e[36minfoe[39m: [debug] Sent shutdown command, waiting for UiAutomator to stop…
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] Time: 54.434e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] OK (1 test)e[39m
e[36minfoe[39m: [debug] e[90m[UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1e[39m
e[36minfoe[39m: [debug] UiAutomator shut down normally
e[36minfoe[39m: [debug] Cleaning up android objects
e[36minfoe[39m: [debug] Cleaning up appium session
e[36minfoe[39m: [debug] Responding to client with success: {“status”:0,“value”:null,“sessionId”:“c7f8b7cd-a458-4e51-ba34-39da37c18f38”}
e[36minfoe[39m: e[37m<-- DELETE /wd/hub/session/c7f8b7cd-a458-4e51-ba34-39da37c18f38 e[39me[32m200e[39me[90m 1001.421 ms - 76e[39m e[90m{“status”:0,“value”:null,“sessionId”:“c7f8b7cd-a458-4e51-ba34-39da37c18f38”}e[39m
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 82.202 sec <<< FAILURE! - in TestSuite
loginToApp(org.ebuilder.tests.navigation.LoginTest) Time elapsed: 51.837 sec <<< FAILURE!
org.openqa.selenium.NoSuchElementException:
An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 25.28 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: ‘2.49.1’, revision: ‘808c23b0963853d375cbe54b90bbd052e2528a54’, time: ‘2016-01-21 09:37:52’
System info: host: ‘nb-dle’, ip: ‘169.254.234.32’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_60’
Driver info: io.appium.java_client.android.AndroidDriver

I can see that cursor is in textbox, and keyboard appears, but text is not inputted.
If I got logs correctly, element is found, but sendKeys method doesn’t work.

Appium 1.4.16, java client 3.3.0, Nexus 5, Android 6.0.1

Maybe smb have face similar problem or know the solution?

hey, I’m not sure if i can help but i’ve faced a similar issue previously and couldn’t find the answer
so i had my own work-around. I know this is not the right way so i would love for someone to tell me the reason why it doesn’t work in google email textbox!

in my case, the driver even couldn’t find the element in the first place so i had to call it by the tag name, and then do a longpress and then type.

WebElement googleEditText = driver.findElement(By.className(“android.widget.EditText”));
TouchAction action = new TouchAction(driver);
action.longPress(googleEditText).release().perform();
driver.getKeyboard().sendKeys(“type gogole ID”);

something like this if i remember correctly.

Can you provide

  1. screenshot of appium inspector or uiautomatorviewer with selecting above EditText field.
  2. Appium log
  3. Your code

Hi @jimmyKim, thank you for reply and help! Your solution works for me! Hopefully it will wotk for password input either :slightly_smiling:

Hi @dasuner, despite the fact it is solved I attach the appium inspector

2 Likes