send_keys enhancement #155
Conversation
Insert character support
|
Hello, thanks for your contribution! |
nathanfallet
left a comment
There was a problem hiding this comment.
That's a lot of changes, especially with the new keys.py file which introduces complexe logic. I think we should add tests to cover the common cases (for the send_keys method of the Tab class, and also most of the complex logic inside of the KeyEvents class. That would make sure everything works as expected, and stays correct in the future (and sometimes they allow us to find hidden bugs)
moving test files to correct folder + remove http server
|
LGTM 👍 |
stephanlensky
left a comment
There was a problem hiding this comment.
This looks really good! Thank you for the contribution. Just one question about the changelog and then a tiny nit for the code, then I'll get this merged and released for you.
| from zendriver import SpecialKeys, KeyModifiers, KeyEvents | ||
|
|
||
|
|
||
| async def test_visible_events(browser: zd.Browser): |
Co-authored-by: Stephan Lensky <8302875+stephanlensky@users.noreply.github.com>
Co-authored-by: Stephan Lensky <8302875+stephanlensky@users.noreply.github.com>
Description
tldr: Refactored keyboard input with new KeyEvents system, adding modifier and special key support, improved event handling, and fully backwards compatible.
KeyEventsclass inzendriver.core.keysKeyEvents.from_text()class method for converting plain text to cdp eventsKeyEvents.from_mixed_input()class method for handling mixed sequences of text, special keys to cdp eventsCHAR,KEY_DOWN,KEY_UPDOWN_AND_UP) as a combination ofKEY_DOWNandKEY_UPElement.send_keys()now uses the newKeyEventssystem (it is still backwards compatible with passing a string)Pre-merge Checklist
./scripts/format.shand./scripts/lint.shscripts. My code is properly formatted and has no linting errors.[Unreleased]section.