This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
10 / 21
Sep 2017

This is the excerpt from my test code
driver.findElement(By.name(“Search Job Guides”)).sendKeys(“guide”);
driver.pressKeyCode(66);

I am now updating appium. Lets see if that works.

@mbasit how about:

 ((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.KEYCODE_SEARCH); //int KEYCODE_SEARCH = 84;

I have tried both
Updated appium version to 1.6.5
Also tried with this piece of code, still getting the same error “The method pressKeyCode(int) is undefined for the type AndroidDriver”

Sorry I meant still getting the same undefined method error.

Sure

Btw, I have tried with both AndroidDriver and WebDriver. Got the same error for both.

Hey,

Yes the code is working now. Thanks a ton for that but I am still unable to tap on the Search key. I have tried to tap on other keys and it works perfectly fine but it does not tap on the search key.

@mbasit tried and it was worked below with mine app:

        ((AndroidDriver) driver).pressKeyCode(AndroidKeyCode.ENTER);
19 days later

@Aleksei @mbasit

I’m having the same problem. The code below does not seem to do anything against genymotion with soft keyboard enabled.

androidDriver.pressKeyCode(AndroidKeyCode.KEYCODE_SEARCH);

It would be great if someone who has workaround would share their solution.

7 months later

I also faced same issue, so as a solution i used below code:

TouchAction touchAction=new TouchAction(driver);
touchAction.tap(xPosition, yPosition).perform();

tap at paritcular coordinates. Using Appium inspector you can find the coordinates.

6 months later
1 month later

I have the same issue enter or search keys do not work on appium (Appium latest version, using real device)
driver.pressKeyCode(AndroidKeyCode.KEYCODE_ENTER);
I also tried keycode=66 that does not work either .

Any ideas? Thanks

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

This should work.