Skip to content

Instantly share code, notes, and snippets.

@maggiesavovska
Last active March 26, 2018 18:42
Show Gist options
  • Save maggiesavovska/760ce97ca2c0dd60367c1cb83d10fd72 to your computer and use it in GitHub Desktop.
Save maggiesavovska/760ce97ca2c0dd60367c1cb83d10fd72 to your computer and use it in GitHub Desktop.
Summary of sendKeys() and moveTo() Issues
Bunch of stuff broken? Don't fear..the Actions API is on it's way and it will probably be a good thing! Chin up!
OVERVIEW:
The purpose of this document is to explain the new actions API and what it has to do with certain commands
such as moveto and keys being depricated in webdriverio (due to them being deprecated in certain browser drivers).
MAIN ISSUE:
1. The issue is that these new drivers suppress these commands on purpose because they are deprecated,
but the drivers have not yet implemented the new WC3 standard called "actions API".
"The user-facing API for emulating complex user gestures. Use this class rather than using the Keyboard or Mouse directly."
See Here: https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/interactions/Actions.html
BROWSERS AFFECTED:
For information on Chrome and Firefox see below:
chrome:
https://chromium.googlesource.com/chromium/src/+/master/docs/chromedriver_status.md
firefox:
https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver/status
https://bugzilla.mozilla.org/show_bug.cgi?id=1292178
Safari:
https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/4136
WHAT IS WEBDRIVERIO DOING ABOUT IT?
The actions command has been implemented in version 4.9.9:
https://github.com/webdriverio/webdriverio/commit/b78172b6da8788a4dc38f056918d425bf4512ff1
Quote from Christian:
"The moveTo is not part of the Webdriver spec and might be working in browser differently.
It will be deprecated soon and you should replace that command by using the Action API once it is implemented."
QUESTIONS:
1. What does this mean? Will the new actions api change how we are testing stuff?
- It depends on how each driver implements it, however, the new actions API will most likely be an improvement,
not a step back.
This is a great reference describing what the actions api entails:
https://github.com/SeleniumHQ/selenium/wiki/Advanced-User-Interactions
Here is the wc3 doc (see #17 Actions):
https://www.w3.org/TR/webdriver/#conformance
PATCHES:
Some people are using in-browser patches until all browsers have fully implemented the actions API.
jquery keys patch courtesy of Thamu Gurung @thamu_gurung_twitter
https://gist.github.com/maggiesavovska/51eb0f826bec743f83c3cc8b25650dff#file-wdio-jquery-browser-patch-keys-js
@midgettj
Copy link

Anyone have any idea on how to "workaround" this ?

@maggiesavovska
Copy link
Author

@maggiesavovska
Copy link
Author

mouseover patch courtesy of @CBedzz

browser.execute(() => { $(selector).trigger('mouseover'); $(selector).click(); });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment