D. Hoang D. Hoang - 3 months ago 13
Android Question

What is the command for Selenium Driver to click on the green check on the android keyboard for automated testing?

Android Keyboard Picture

I'm doing automated testing to send a text. The app does not have a "submit" button but rather by clicking the green check of the android keyboard, it will submit the text. UIAUTOMATORVIEWER does not show the element or any form of id when it comes to the android keyboard.

Thing's that I have tried is:

driver.sendKeys(Keys.ENTER)
sendKeys(66) (66 = ENTER)

Answer

For key events, you need to use driver.pressKeyCode()

So what you want is driver.pressKeyCode(66). If you want it to be even more readable: driver.pressKeyCode(AndroidKeyCode.ENTER)

Also keep in mind pressKeyCode only works for AndroidDriver.

Comments