Closed vincentdieltiens closed 8 years ago
The chromedriver project has had a bunch of weird bugs with keyboards (especially non-US ones). See https://bugs.chromium.org/p/chromedriver/issues/detail?id=627 (and search for sendKeys in their issue tracker). 627 is marked fixed, but there may still be issues.
You can enable chromedriver logger (see http://stackoverflow.com/questions/31662828/how-to-access-chromedriver-logs-for-protractor-test) to get more details about what keycodes are being sent.
After enabling chromedriver logger (with the solution (given by jmr) of running chromedriver in a separate process), here are the logs relatives to the key event :
[5.643][INFO]: COMMAND TypeElement {
"id": "0.9101050850003958-1",
"value": [ "", "a", "" ]
}
...
[5.677][DEBUG]: DEVTOOLS COMMAND Input.dispatchKeyEvent (id=47) {
"modifiers": 0,
"nativeVirtualKeyCode": 81,
"text": "",
"type": "rawKeyDown",
"unmodifiedText": "",
"windowsVirtualKeyCode": 81
}
[5.678][DEBUG]: DEVTOOLS RESPONSE Input.dispatchKeyEvent (id=47) {
}
[5.678][DEBUG]: DEVTOOLS COMMAND Input.dispatchKeyEvent (id=48) {
"modifiers": 0,
"nativeVirtualKeyCode": 0,
"text": "a",
"type": "char",
"unmodifiedText": "a",
"windowsVirtualKeyCode": 0
}
[5.678][DEBUG]: DEVTOOLS RESPONSE Input.dispatchKeyEvent (id=48) {
}
[5.678][DEBUG]: DEVTOOLS COMMAND Input.dispatchKeyEvent (id=49) {
"modifiers": 0,
"nativeVirtualKeyCode": 81,
"text": "",
"type": "keyUp",
"unmodifiedText": "",
"windowsVirtualKeyCode": 81
}
[5.678][DEBUG]: DEVTOOLS RESPONSE Input.dispatchKeyEvent (id=49) {
}
So, chromedriver seems to get "a" and translate it to the keyCode 81
which is incorrect...
Pretty sure this is a ChromeDriver issue. I don't see an open issue of theirs for dealing with this, so we should find the minimal test case and create an issue with them.
I can't reproduce w/o a custom keyboard - @vincentdieltiens could you please open an issue with chromedriver at https://bugs.chromium.org/p/chromedriver/issues/list? Thanks.
Closing this as stale and not helpful to keep open.
When I use the sendKeys method to test a homemade hotkey service, Some tests are failing with chrome for some keys like
a
orq
.The method
sendKeys
seems to send the wrong keycode :a
it sends81
(instead of65
)q
it sends65
(instead of81
)w
it sends90
(instead of87
)The keys for which there is a problem seems to be 'querty' and 'azerty'... I provide below a very simple example that fails with chrome (and should not) and passes with firefox.
Note that i'm using a french version of chrome and firefox with an apple azerty keyboard.
Bug report
v4.3.2
3.1.1
chrome 49.0.2623.75
Mac OS X 10.11 El capitan
A relevant example test Index.html :
listener.js :
example.html :
listener.e2e.js :
Output from running the test
Thanks, Vincent