We are happily using HtmlUnit 3.4 with Selenium and wanted to get rid of some legacy usage of the deprecated KeyboardEvent.keyCode in our web application.
The most portable replacement would be KeyboardEvent.key, but this is currently not working for arrow keys. For example sendKeys(Keys.UP)
on a element yields &
in JavaScript for KeyboardEvent.key
as opposed to the expected "ArrowUp"
. &
in ASCII is 0x26
which is the corresponding KeyboardEvent.keyCode
.
Stating from the implementation the current support for KeyboardEvent.key
seems to be limited to printable characters, "Shift"
, "Enter"
and Period
(KeyboardEvent.determineKey()).
As KeyboardEvent.key is part of the W3C UI Events standard and is broadly supported by current browsers (caniuse) it would be really nice to have this as well in HtmlUnit.
Mozilla provides a extensive table of common control and special characters in the mdn
Thanks for the continuous support and effort you put into HtmlUnit.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too