New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 662061 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue chromedriver:1502
Owner:
Last visit > 30 days ago
Closed: Nov 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Chrome , Mac
Pri: 2
Type: Bug



Sign in to add a comment

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/
 
Components: Tests>WebDriver
Labels: OS-Chrome OS-Linux OS-Windows
Labels: TE-NeedsTriageHelp
Owner: samu...@chromium.org
Status: Assigned (was: Unconfirmed)
Assigning to samuong@ who owns chrome/test/chromedriver for further action.
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

Mergedinto: chromedriver:1502
Status: Duplicate (was: Assigned)

Sign in to add a comment