Repository navigation
Description
This is an issue to plan and track progress of implementing W3C WebDriver protocol into php-webdriver.
Currently, only legacy JsonWire (aka OSS) protocol is supported by php-webdriver. Selenium server 3.x translates the protocol if needed for the remote end (browser). However not everything is translated (like actions()), making some of the features not working with remote ends supporting only the W3C protocol (which is currently only GeckoDriver for Firefox 48+).
Since Selenium 3.5 the translation to old protocol is disabled by default. It still could be reenabled by starting the server like java -jar selenium-server-standalone-3.5.3.jar -enablePassThrough false, but this is only partial and temporary solution/workaround.
For Docker 🐳 users: use SE_OPTS environment variable to pass the enablePassThrough option to Selenium server. Ie. add -e "SE_OPTS=-enablePassThrough false" to docker run command.
The work would require eg.:
- add some more functional tests, to make sure we don't breake the old protocol while doing the necessary refactoring
- prepare handshake to detect whether the remote end is speaking JsonWire or W3C dialect (we need this to support the old browsers etc.)
- define common interface for Json and W3C protocol
- convert current implementation to use this interface
- implement adapter for the W3C protocol
- implement GeckodriverService or something like that to start geckodriver locally
...
Resources
- JsonWireProtocol vs. W3C WebDriver
- ProtocolHandshake in java bindings
- Handshake and capabilities resolving in python bindings
Activity
OndraM commentedon Sep 9, 2017
I started working on https://github.com/facebook/php-webdriver/wiki/JsonWireProtocol-vs.-W3C-WebDriver . I'd like to summarize there the key protocol differences before we start actually implementing them in the code.
Any help with this overview document will be much appreciated!
paulbriton commentedon Oct 3, 2017
Spec also contains changes about the JSON returned when finding an element.
The key
ELEMENTis no longer used for referencing an element so we have an undefined index inRemoteWebDriver.phpline 178. See this issue on selenium for more details.Here is an example of the JSON returned by IEDriverServer (which now implements the spec in its latest version, 3.6):
{"state":"success","sessionId":null,"hCode":1164912850,"value":{"element-6066-11e4-a52e-4f735466cecf":"a1c4646c-8300-49f2-84b3-182911dc3eb6"},"class":"org.openqa.selenium.remote.Response","status":0}davidmintz commentedon Oct 25, 2017
It would be great if the docs were updated to warn people about this and potentially save them a couple hours of pain. Are you interested in a PR to this effect?
OndraM commentedon Oct 25, 2017
@davidmintz I've recently added note about passThourghMode to readme. However we can do more, for sure :). What is on your mind?
I'm also hoping to have some time for the issue itself during November...
davidmintz commentedon Oct 25, 2017
@OndraM sorry, I guess I missed that in the README, but I read your discussion about
-enablePassThrough false, and tried it, but I am still exploding when I try tosendKeys(), withFacebook\WebDriver\Exception\UnrecognizedExceptionException: Expected [object Undefined] undefined to be a stringand I 'm unclear whether this rooted in the same issue as the undefined 'ELEMENT" index, or something else.I do know it's making me crazy and I would love to help, just don't know if I have what it takes in terms of knowledge.
At the moment the only workaround that works for me is to use a very dated toolchain: Selenium 2.44 with Firefox 35. With the current versions of everything plus Chrome, I get "chrome is unreachable" and I've been all over the map trying to solve that one.
alexmnv commentedon Dec 28, 2017
Note for Docker users: Selenium parameters are passed through
SE_OPTSenv variable. i.e, you need to add-e "SE_OPTS=-enablePassThrough false"todocker runcommandAdding -enablePassThru flag to selenium startup to fix error "failed …
paulbriton commentedon Jan 12, 2018
Hi @OndraM ! Happy new year ;)
Any news on this issue ? I've found this Github repo which is based on an old version of this project and which implements the W3C protocol (at least it says so). Maybe it could help !
pribbernow-marc commentedon Feb 13, 2018
For selenium-server-standalone version > 3.9.1: the option enablePassThrough doesn't work, just switch to version 3.8.1 to use this workaround for firefox
OndraM commentedon Feb 17, 2018
Hi everyone, I'm aware of the situation, including the fact you cannot effectively use Selenium 3.9.0+ with remote ends supporting only the new W3C protocol (especially Firefox), due to removal of the
enablePassThrough- you must stick with the previous version for the time being. Sorry for this! However those remote ends, which sill supports the old protocol (like Chrome) still DO work perfectly.I also hope I will be able to share some more information about W3C protocol support quite soon. I know the missing support may be limiting for you now (but also workaround exists - see previous messages), but please hang tight :).
OndraM commentedon Feb 25, 2018
Sorry, my previous statement was not accurate - you only cannot use Selenium 3.9 with remote ends supporting only the new W3C protocol (especially Firefox), because Selenium Server now won't do the translation to the new protocol. But those remote ends, which sill supports the old protocol (like Chrome) still DO work perfectly.
36 remaining items
Enable W3C protocol for Chromedriver 🎉 php-webdriver#469
OndraM commentedon Nov 12, 2019
📢 Current status update:
What needs to be mentioned again - the W3C protocol support is experimental (and will remain experimental in upcoming php-webdriver 1.8). Some parts (like capabilities) are not yet implemented to fully conform W3C WebDriver protocol. However most of the stuff should work.
What will be the process now:
and running
composer update.(Or you can just run
composer require php-webdriver/webdriver:^1.8@dev).🔥 🔥 🔥
Add convertor to W3C compatible capabilitites (fixes #676, part of #469)
Add convertor to W3C compatible capabilities (fixes #676, part of #469)
Add convertor to W3C compatible capabilities (fixes #676, part of #469)
OndraM commentedon Nov 18, 2019
The
communitybranch now contains further W3C protocol-related improvements:🔔 Everyone please test the community branch and report issues!
composer require php-webdriver/webdriver:^1.8@devsathyas123 commentedon Dec 23, 2019
OndraM commentedon Dec 24, 2019
andrewnicols commentedon Jan 6, 2020
@OndraM, do you think that we may be able to release 1.8.0 shortly? I think we're nearly up to full compliance with the W3C spec (just a couple of missing commands which mostly have pull requests). Do you have a timeframe in mind?
OndraM commentedon Jan 7, 2020
No exact timeframe, but I've created 1.8.0 milestone to track reamining issues. There is just a few of them, so it should not take long. And I don't think we necessarily need full W3C compliance, this would be aim of 2.0. We just need "good enough" implementation in 1.8 :-).
OndraM commentedon Jan 20, 2020
📢 One more announcement for everyone watching this issue and waiting for W3C support.
As we move towards release 1.8.0, we successfully transferred the repository from Facebook (as explained in #730) and it is now available under new name. So in order to get any future updates of the package, you must update its name in require section of your composer.json file like this:
"require": { - "facebook/webdriver": "(version you use)", + "php-webdriver/webdriver": "(version you use)", }OndraM commentedon Feb 10, 2020
🎉 Version 1.8.0 was released!
Thanks to all 14 community contributors who made this possible (in 120 commits)! 🥇 ❤️
🆕 Have look at complete changelog.
Version 1.8.0 includes experimental support of W3C WebDriver protocol, and it will be used by default if your browser supports it (recommended is latest Chrome/Firefox). If you encounter any issues with the W3C protocol, you can still explicitly disable the protocol and use the legacy "JsonWire OSS protocol", but please also report the issue here on GitHub.
Also don't forget to rename the library in your composer.json:
"require": { - "facebook/webdriver": "...", + "php-webdriver/webdriver": "^1.8.0", }before you run
composer update.If you use Selenium standalone server, make sure to use the latest version (either stable 3.141.59 or you can try alpha version of Selenium 4) and remove no longer needed
enablePassThroughworkaround you might used previously.Happy testing!