How to press ENTER keyboard when search data on mobile apps


#22

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.


#23

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:

https://appium.github.io/java-client/index.html?io/appium/java_client/android/nativekey/PressesKey.html

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

– Chris


#24

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


#25

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:

https://docs.katalon.com/katalon-studio/docs/mobile-tap-at-position.html

Hope this helps,

Chris