WebDriver Moves To A W3C Recommendation

Posted Jun 8th, 2018

The W3C has officially moved the WebDriver protocol to recommended state, which means it is officially supported and endorsed by W3C. The Selenium Project added stable support for the W3C protocol in Selenium v3.8 through v3.11 and has indicated plans to migrate entirely to the new protocol in all upcoming versions.

There are three main advantages to the W3C protocol:

  • There will be an agreed to standard that all browser vendors will develop to so your tests should be run more consistently between browsers
  • The standard protocol has been developed with stability in mind, so Selenium tests in general will be more stable
  • The Actions API has been updated and is far richer than what was in the JSON Wire protocol. Pinch and zoom and rotating around a point as opposed to the normal drag and drop are now supported

You can read more of the spec for detailed changes. 

No changes to Selenium Test Scripts need to be made to run with the W3C protocol. The W3C protocol interprets standard Selenium commands and runs these appropriately.

However, you do need to make adjustments to the way you invoke Sauce-specific commands in order to use them with the W3C protocol. Sauce specific Selenium commands are ones that work outside the W3C protocol but provide enhanced features for tests such as: specifying browser versions, initiating secure tunnels, Extended Debugging etc.

To use Sauce-specific commands with the W3C protocol you need to invoke the new sauce:options command, at a global, setup level. Selenium will then interpret the commands appropriately and apply them to all the tests that follow.

Today, starting with Selenium v3.8 up to the latest version, Selenium 3.11, Sauce Labs supports the W3C protocol when you use the sauce:options command in your setup. Upcoming Selenium versions and browser vendors will default to the W3C protocol. So, to future proof your tests, we recommend testing on W3C protocol with our sauce:options capability as soon as possible.

Here are details about the W3C protocol on Sauce Labs.

Here’s an informational web page about all things W3C on saucelabs.com. 

Written by

Ken Drachnik


Open sourceSelenium