question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Key Event 'KEYCODE_SEARCH' doesn't work (do nothing)

See original GitHub issue

Description

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.

Environment

  • java client build version or git revision if you use some shapshot: 5.0.4
  • Appium server version or git revision if you use some shapshot: 1.8.1
  • Desktop OS/version used to run Appium if necessary: Ubuntu
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe:
  • Mobile platform/version under test: Android 6
  • Real device or emulator/simulator: Real device

Details

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 ?..

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
jarod-legaultcommented, May 16, 2019

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”.

0reactions
zcmgyucommented, Jun 19, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Event.keyCode doesn't work with 'on input' - undefined
Try doing it with onkeydown and you will be able to access e.keyCode. so instead of: <input onkeypress="getKeyValue()"/>. You should do:
Read more >
KeyboardEvent.keyCode - Web APIs - MDN Web Docs
[4] No key events are fired. [5] The key isn't available with Greek keyboard layout (does not input any character). The value of...
Read more >
JavaScript Keycode List – Keypress Event Key Codes for ...
The keypress event works only for a subset of the keys. You can't capture the Alt, Ctrl, Shift, Meta, and other similar key...
Read more >
Keyboard: keydown and keyup - The Modern JavaScript Tutorial
Please note that special keys, such as Backspace , Left , Right , do not work in the input. That's a side effect...
Read more >
keydown and keyup events do not have proper keyCode (it's ...
Steps to reproduce: 1. Load the attached HTML file in Chrome for Android. 2. Click on the input element. 3.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found