Closed asashour closed 7 years ago
I've recently encountered this problem as well. Specifically, I have a test of a terminal emulator that is sensitive to the actual keyCodes of the keydown event. For example, pressing the hyphen ('-') key should send keycode 173, but FirefoxDriver sends keyCode 45, which corresponds to the Insert key. The wrong keycode causes the terminal emulator to inappropriately call preventDefault() on the event (and as of https://github.com/SeleniumHQ/selenium/commit/94d41301a809d3b7de0791b41ac3fd950d4a24fb, that prevents the ensuing keypress event from firing).
The hyphen problem is fixable by adding something like this to https://github.com/SeleniumHQ/selenium/blob/master/javascript/firefox-driver/js/utils.js:
} else if (c == '-') {
keyCode = Components.interfaces.nsIDOMKeyEvent.DOM_VK_HYPHEN_MINUS;
charCode = c.charCodeAt(0);
}
But for the symbols that appear on number keys (such as !@#, etc.), I'm not sure if that is the right approach. In @asashour's example, '!' should have keyCode 49 (the keyCode for the '1' key). There is a keyCode available for a '!' key (DOM_VK_EXCLAMATION = 161), and that would probably work, but it wouldn't really simulate the typical way that users send '!'.
@barancev Any opinions on how we could fix the keycodes here? I would be happy to contribute as needed.
This issue is not going to be fixed in legacy Firefox driver, no matter if it is still actual or not.
For the new Firefox driver implementation (aka geckodriver) watch https://github.com/mozilla/geckodriver/issues/646
Hi all,
I am not sure if this is related to #510
With:
For the below html, and typing
!
, real firefox printsdown: 16,0 down: 49,0 press: 0,33 up: 49,0 up: 16,0
however, WebDriver prints
down: 16,0 down: 33,0 press: 0,33 up: 33,0 up: 16,0
HTML:
Java
Please let me know if I should submit a PR with
@Ignore
test case in TypingTest