Created
June 22, 2017 17:21
-
-
Save maggiesavovska/51eb0f826bec743f83c3cc8b25650dff to your computer and use it in GitHub Desktop.
Webdriverio compatible in browser patch for keys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// courtesy of Thamu Gurung @thamu_gurung_twitter | |
browser.execute(() => { | |
return $(elementSelector).trigger({ type: 'mousedown', which: 39 }); | |
}); | |
/* The Key codes | |
rightArrow - 39 | |
leftArrow - 37 | |
down - 40 | |
enter - 13 | |
full list of keys and codes : https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes | |
Note: The most important here is the type of event associated. As I asked my developer and he told me that the event is "mousedown". In some cases this might be "mouseup" or "keydown" . It is always better to have the library of events which your developer is following. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment