How to press ENTER keyboard when search data on mobile apps


Hi @Chris_Trevarthen Thank You.

Have tried the above solution but actually the issue is post entering the text I am using Mobile.hidekeyboard() but its not working as an enter. So I think here have to use some keyboard enter event just to get the search result.

I have used the driver = MobileDriverFactory.getDriver()
driver.pressKey(new KeyEvent(AndroidKey.ENTER)) but looks like the PressKey is deprecated.


Hi @QA21,

You’re right, I don’t think the Mobile.hideKeyboard() function is guaranteed to send a return/enter key. I think that pressKey is still ok, but pressKeyCode is deprecated per the Appium docs:

If pressKey is working for you, I would say to keep using it. If it’s not, let’s troubleshoot further.

– Chris


Hi @Chris_Trevarthen tried so many ways but still struggling with the above.
Could you pleas help me out?


Hi @QA21,

If none of the above options work for you, you can try using the tapAtPosition function, tapping at the coordinates where the enter button will be. You should be able to calculate this based on your screen size:

Hope this helps,