Skip to content

Commit

Permalink
[js] Another pass at the new actions API for #4564
Browse files Browse the repository at this point in the history
The previous iteration heavily favored sequences where multiple devices acted
in each tick. This also made it too difficult for "simple" sequences like
"press SHIFT, move the mouse (0, 30), press LEFT, release LEFT, etc." This new
version goes back to favoring simple, synchronous sequences, but still allows
configuring async sequences.

The new input.Actions class API is largely compatible with
actions.LegacyActionSequence, however, the mouse methods have been renamed to
force a breakage since there is a change in parameters.

The new API still supports translating mouse+keyboard sequences to the legacy
protocol, but users have to explicitly request this when the sequence is first
created (translation is opt-in because it's not 100%; known issues are all
covered in the input.Actions class doc)
  • Loading branch information
jleyba committed Jan 8, 2018
1 parent f63a810 commit 2e91397
Show file tree
Hide file tree
Showing 13 changed files with 2,462 additions and 710 deletions.
19 changes: 11 additions & 8 deletions javascript/node/selenium-webdriver/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ mode.
- InvalidElementCoordinatesError
* Changes to `lib/webdriver.WebDriver`:
- Dropped support for "requiredCapabilities" from WebDriver.createSession
- actions now returns the new `lib/input.Actions` class
- removed touchActions
* Changes to `lib/webdriver.Alert`:
- Removed authenticateAs
* Changes to `lib/webdriver.Options` (`driver.manage()`):
Expand Down Expand Up @@ -153,14 +155,15 @@ mode.

* Revamped the actions API to conform with the WebDriver Spec:
<https://www.w3.org/TR/webdriver/#actions>. For details, refer to the JS doc
on the `lib/webdriver.ActionSequence` class.

As of December, 2017, only Firefox supports this new API.
`ActionSequence#perform()` will attempt to translate mouse and keyboard
sequences to the legacy API. Alternatively, you may continue to use the
legacy API directly via the `lib/actions` module. __NOTE:__ The legacy API
is considered strongly deprecated and will be removed in a minor release once
Google's Chrome and Microsoft's Edge browsers support the new API.
on the `lib/input.Actions` class.

As of January, 2018, only Firefox natively supports this new API. You can
put the `Actions` class into "bridge mode" and it will attempt to translate
mouse and keyboard actions to the legacy API (see class docs). Alternatively,
you may continue to use the legacy API directly via the `lib/actions` module.
__NOTE:__ The legacy API is considered strongly deprecated and will be
removed in a minor release once Google's Chrome and Microsoft's Edge browsers
support the new API.

* All window manipulation commands are now supported.
* Added `driver.switchTo().parentFrame()`
Expand Down
2 changes: 1 addition & 1 deletion javascript/node/selenium-webdriver/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ Channel.RELEASE = new Channel(
* @see <https://www.mozilla.org/en-US/firefox/channel/desktop/#nightly>
*/
Channel.NIGHTLY = new Channel(
'/Applications/FirefoxNightly.app/Contents/MacOS/firefox-bin',
'/Applications/Firefox Nightly.app/Contents/MacOS/firefox-bin',
'Nightly\\firefox.exe');


Expand Down
1 change: 0 additions & 1 deletion javascript/node/selenium-webdriver/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,6 @@ class Builder {
// PUBLIC API


exports.ActionSequence = webdriver.ActionSequence;
exports.Browser = capabilities.Browser;
exports.Builder = Builder;
exports.Button = input.Button;
Expand Down
Loading

0 comments on commit 2e91397

Please sign in to comment.