-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Add support for W3C actions to node client #4564
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
Comments
I just ran into this as well. I'm running tests on Windows with Firefox 55 and a recent version of the gecko driver and I'm getting this error:
(Full bug report: mozilla/geckodriver#958) My tests work perfectly in Chrome and Chrome Headless, but not Firefox. |
Just hit this too running selenium standalone firefox docker container.
|
I completely overhauled the actions API to support W3C. I'm not entirely sure how I feel about the API (or the API for any of the language bindings for that matter). It's kind of difficult to setup given how you can define parallel sequences across multiple devices. Please take a look and let me know what you think -- note I'm not planning on publishing another npm release until 4.0, so you'll have to grab this from head. I'm hoping for feedback on documentation [1] and overall usage [2]. [1] https://github.com/SeleniumHQ/selenium/blob/master/javascript/node/selenium-webdriver/lib/webdriver.js#L2522 |
Hey @jleyba, sorry for the late reply, had some busy days. First, thank you for implementing the new API, that's awesome! 👍 After having a look at the W3C spec, I think the proposed API captures it pretty well. Some thoughts:
I see you removed support for the legacy version of It would be even better for backward compatibility if the old |
Just a short addition to the previous feedback: I've refactored one of our UI tests to use the new API, ran it with a current local Firefox and everything works as expected :) . Without the legacy version available, it does not work with any other common browser, as none has implemented the new spec yet: |
Thanks for the feedback. I think I'm going to try to transparently support the legacy protocol (if W3C actions fail, it will translate to legacy and try again). I just started looking at it, but I'm hoping to have something to push within a few days. |
…API, translate actions to a command sequence against the legacy API and try again. This change only supports translating mouse and keyboard actions. A subsequent change will add support for translating touch pointers. (For #4564)
…ine and execute a single device sequence. For #4564
- Update documentation - Resurrect the legacy API (too difficult to accurately translate touch actions in the new API to legacy commands). The legacy API will be removed once Chrome and Edge support the new API. For #4564
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)
OK, I'm happier with this latest version. It's pretty similar to the legacy API, but still makes it possible to define parallel actions for the browsers that support it (right now just Firefox). The new API does support translating to mouse+keyboard actions to the legacy API, but it's not 100%, so you have to explicitly enable this behavior (see the new docs for details) No browsers currently support touch/pen actions with W3C actions, so those aren't surfaced through the API yet. |
The new API is included in |
@jleyba I am still facing the same issue with 4.0.0-alpha.1. POST /session/{sessionId}/moveto did not match a known command |
I'm seeing this with
Ah, markdown is stripping some data out. Basically I'm getting an HTML file output that complains in a PRE tag that it "Cannot POST /session". |
@jleyba does this also have an affect when using directConnect in protractor? or does it then skip all selenium related issues? |
@sahil1610 & @biot023 you have to use @alexandergallen Sorry, I have no idea what "directConnect in protractor" is. |
jleyba, W3C actions were 3 months ago only supported in firefox. Since actions are broken on HEAD for chrome (were 3 months ago), we need clearer error messages, or doc about the legacy fallback that is very nice. |
@MagicPoulp pull requests are always welcome |
On 4.0.0a1 |
"@MagicPoulp pull requests are always welcome" My suggestion was to do mainly documentation. Something as fundamental as using actions was broken on HEAD. WHen something does not work, it is common for people to have a look at the CHANGES. This is where I learnt about the W3C thing. The fallback mechanism you provided is not 100% "plug-and-play". People still get errors when they don't know about it, you should document. I had other issues with actions with actions involving SVG DOM objects not behaving the same across browsers. --> suggestion to improve the quality of this repo (it is already of quality the Javascripy selenium is much cooler than in other frameworks 100%): |
This has been open for a while but I believe W3C actions should be already implemented in the JS bindings, do you know if this is true @harsha509? |
Hi @diemol , Yes, W3C actions are implemented in the JavaScript bindings (Checked in alpha 4 versions, also we have good code samples tested in here https://www.selenium.dev/documentation/en/support_packages/mouse_and_keyboard_actions_in_detail/). But, Am not sure if this thread contains discussion about any other issue (as i see lot of tagged links of issues from protractor). This issue is also referenced in selenium-ide too in here SeleniumHQ/selenium-ide#329, So @corevo comments also will be helpful in conforming this. Thanks, |
Thanks, @harsha509! |
tl;dr Please implement the W3C actions API for the node client.
Using the latest selenium-webdriver node client (3.5) to drive a local instance of the latest Firefox (55) on Linux, calling the user interactions API results in the infamous
UnknownCommandError: POST /session/[...]/moveto did not match a known command
error.To my understanding, Firefox / geckodriver has implemented the W3C actions API, while the node client at the moment only supports an older version of the API (having a quick look at http.js, the
/actions
endpoint is missing).It seems this has already been implemented in other language bindings, for example the Java client. It would be awesome if we could get W3C action support for the node bindings to :) .
PS: Thanks for your great work on Selenium!
The text was updated successfully, but these errors were encountered: