Hello,
Key Event 'KEYCODE_SEARCH' doesn't work (do nothing)
AndroidDriver dr;
dr.sendKeyEvent(AndroidKeyCode.KEYCODE_SEARCH);
I test it with a click on google search on android home, and after type toto.
I test with a keypress with adb :
```
adb shell input keyevent KEYCODE_SEARCH
````
I have the same problem. So, perhaps it's because of adb ?...
Try
pressKey(new KeyEvent(AndroidKey.ENTER)
.withFlag(KeyEventFlag.SOFT_KEYBOARD)
.withFlag(KeyEventFlag.KEEP_TOUCH_MODE)
.withFlag(KeyEventFlag.EDITOR_ACTION));
This snippet works with java client 6.0.0-stable and the UIAutomator2 bundled with Appium 1.8.1+
Hi @mykola-mokhnach,
This workaround works, but it's really the same as a SEARCH keyevent ?
It should be. This snippet simulates sending IME action and Espresso, for example, does the same trick.
@mykola-mokhnach is there a Webdriverio solution for this as well because it currently does nothing with Webdriverio
This solution in JavaScript using wd worked for me:
return driver.waitForElementById(<elementId>).type(<text to type>).click().execute( "mobile: performEditorAction", { "action": "search" } );
This allowed me to find a text field, input some text, and submit a search command (same as clicking the search icon in the keyboard). Of course, you have to replace <elementId> and <text to type> with the proper values. See http://appium.io/docs/en/commands/mobile-command/ for details on "mobile: performEditorAction".
@jarod-legault Awesome
Most helpful comment
This solution in JavaScript using wd worked for me:
return driver.waitForElementById(<elementId>).type(<text to type>).click().execute( "mobile: performEditorAction", { "action": "search" } );This allowed me to find a text field, input some text, and submit a search command (same as clicking the search icon in the keyboard). Of course, you have to replace
<elementId>and<text to type>with the proper values. See http://appium.io/docs/en/commands/mobile-command/ for details on "mobile: performEditorAction".