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,


1 Like

It worked for me, thanks @Goran

1 Like

Hello Everyone, If you still didn’t get any solution regarding this, then try this. It’s works for me.

First Import

    import as MobileDriverFactory
    import as AndroidDriver
    import org.openqa.selenium.Keys as Keys
    import com.kms.katalon.core.logging.KeywordLogger
    import as ImmutableMap;

Then called AndroidDriver

AndroidDriver<?> driver = MobileDriverFactory.getDriver()

Now select that Text field by spying/recording/from captured object class name and send your desired text:


Now Click on search by writing this command

driver.executeScript("mobile: performEditorAction", ImmutableMap.of("action", "search"));

1 Like