How can I able to press search button from keyboard of android device?

1.I am using appium for mobile app testing and language as java.
2. I have given below coding to enter the text by using sendkeys.
3. After entering the text, I need to press the search button from keyboard.
4. For that I have used key code event to press the search button. But, search action doesn’t happens for me.
5. How to click an search button by using coordinates?

public static void test_demo() throws Exception {
WebElement element = driver.findElement(“mytextfield”));

// press search button



Have you ever tried with the below ones,

  1. driver.sendKeyEvent(AndroidKeyCode.ENTER);
  2. after your sendKeys(“Chennai”) … element.sendKeys(Keys.ENTER);

Please have a try with those and Hope this helps ,


I have tried with above mentioned idea, it doesn’t worked out.

Do you able to identify that search button in Inspector or UIAutomatorViewer (or) Is there any GO or DONE button displaying on Keyboard or not? Please let me know…!

I have manually done this testing by entering text using keyboard and then I have pressed the search icon(magnifier) button in the device keyboard. Its works fine. I am trying to automate this operation. But, I can able to press the other keys in keyboard using keycode events. But, search button is not working. I don’t find the reason for this, why its not working. Its sure, its a SEARCH button only.

HI @Selvi_Ranganathan ,

Could you please let me know , did you able to identify & handled search button on keyboard …?


@bhaskar, Ya I can able to identify and handle the keyboard event.But, the click event doesn’t happens for me.

Hi @Selvi_Ranganathan ,

Thanks for your reply. Could you please let me know , how did you achieved and what is the alternative for that?


@bhaskar, I have just checked with whether I can bale to access the other keyboard events via key code. I can able to enter the other text in my text box. But, I don’t find the reason for search event doesn’t works for me. When an search button click event occurs, it flicks inside the textbox itself.


Try with the following command. Hope this helps…
adb -s input keyevent KEYCODE_SEARCH


Hi Bhaskar…
As you have mentioned I’m facing the problem regarding clicking the Go option and I have it displaying on the keyboard. Could you help me out?

This worked for me
driver.executeScript("mobile: performEditorAction", ImmutableMap.of("action", "search"));