Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyboardEvent.key support for control and special characters #722

Open
blasss opened this issue Feb 1, 2024 · 1 comment
Open

KeyboardEvent.key support for control and special characters #722

blasss opened this issue Feb 1, 2024 · 1 comment
Labels

Comments

@blasss
Copy link

blasss commented Feb 1, 2024

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.

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar
@polar-sh polar-sh bot added the polar label Feb 2, 2024
@rbri
Copy link
Member

rbri commented Feb 2, 2024

This is a bigger effort, because there is no real support for special keys in HtmlUnit itself. I guess i have to add something like a stream of key-strokes that support special keys the same way like the ordinary ones.
If this available in HtmlUnit i can use for the web driver.

Will start working on this after some other major bugs are fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants