KeyboardEvent.key and KeyboardEvent.code are empty when sending a key via chrome webdriver
Reported by
austin.f...@gmail.com,
Nov 3 2016
|
||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36
Steps to reproduce the problem:
1. Use selenium + chrome webdriver to send an r (or an R) to an input element
2. Have a keyboard event handler display e.key, e.code and e.keyCode
What is the expected behavior?
e.key "r" e.code "KeyR" e.keyCode 82
What went wrong?
e.key is "" e.code is "" e.keyCode is 82
Did this work before? N/A
Does this work in other browsers? N/A
Chrome version: 54.0.2840.71 Channel: n/a
OS Version: OS X 10.11.1
Flash Version: Shockwave Flash 23.0 r0
Sending keys to the element using the keyboard works fine, it is only an issue when sending keys to the element using chrome webdriver / selenium.
I am using the following code to work around the problem
if ("key" in e) {
var key = e.key;
if (key === "" && e.keyCode > 0) {
key = String.fromCharCode(e.keyCode);
}
if (key) {
... do my stuff
}
}
Key is sent using RemoteWebElement context ... context.sendKeys("r")
I use a custom script engine (built on top of selenium) to run my tests: https://github.com/redskyit/ScriptDriver/
,
Nov 7 2016
,
Nov 10 2016
Assigning to samuong@ who owns chrome/test/chromedriver for further action.
,
Nov 10 2016
https://dl.dropboxusercontent.com/u/43876768/cr662061.zip Minimal reproduce case. To run extract the archive, and type bash run. Requires java and ofc chrome run. All other dependencies (chromedriver, selenium and scriptdriver) are included in the archive
,
Nov 10 2016
|
||||
►
Sign in to add a comment |
||||
Comment 1 by shrike@chromium.org
, Nov 4 2016Labels: OS-Chrome OS-Linux OS-Windows