Selenium 4 is now W3C compliant; what does it mean for you?

Archive for the ‘General’ Category

Selenium 4 is now W3C compliant; what does it mean for you?

Posted by KISHORE | Posted On January 7th, 2021 | General

What is Selenium WebDriver

  • Selenium WebDriver drives a browser natively, as a real user would, either locally or on remote machines.
  • Works in all major browsers
  • With Selenium 4, the WebDriver is now a W3C compliant

Introduction to Selenium 4

Selenium 4 is launching soon, with that Selenium WebDriver fully adopted the W3C WebDriver protocol, and have dropped support for the original home-grown JSON wire protocol. Browsers such as Chrome, Safari, Firefox, Internet Explorer and Edge will also follow W3C standardization, therefore browser drivers will interact with Selenium WebDriver in W3C standard protocol. The capabilities format will change in the new standard.


JSON Wire Protocol – the existing protocol

The way that Selenium communicates with a web browser is via a wire protocol that’s effectively just JSON over HTTP. Originally this grew organically as the Selenium team figured things out, and tried to make browsers do what is needed them to. That original protocol is known as the JSON wire protocol because it spoke JSON over the wire.

So, the Protocol that Web Driver has been running for a long time is called JSON Wire Protocol. However, starting with Selenium 4 this protocol will no longer be supported.

WebDriver W3C Protocol – the new protocol

That original protocol was the base for the W3C WebDriver protocol, which smoothed some of the rough edges, and brought some much-needed consistency to the protocol. The two major areas the standardized protocol improved on included session creation, where it removed considerable ambiguity, and by providing a far richer API for specifying user actions. The most important difference in the actions API is that you can now do multiple actions simultaneously.

The new protocol is called: “WebDriver W3C”. It has received the endorsement of the “World Wide Web Consortium” (W3C). This is an international community that works to develop Web standards. The creation of this protocol started 6 years ago and just one year ago it finally became a standard. W3C is fractionally different from the original protocol.

What does this adoption of the W3C protocol mean for you?

To be honest, it probably doesn’t mean much to you at all. If you’re using a modern browser (released over the past couple of years), you will find that actually you already speak the W3C protocol with Selenium 3.


Then, who does care about the protocol? – Cloud Platforms!

When we talk about companies like SauceLabs, BrowserStack, LambdaTest; who provide Selenium as a service—they care about it. The ecosystem is ready for this next step, because the technical folks at these companies have ensured that they understand and comply with the W3C protocol, and folks from the Selenium project have been there offering help and advice as needed.


What does it mean to the existing Selenium Automation Projects?

One of the other nice things about Selenium 4 is that it has a stable user-facing API. That means when you upgrade your project from Selenium 3 to Selenium 4, it should be a drop-in upgrade. You just change the version number, recompile and you should be done.


Mobile Automation

It is important to point out that WebDriver API has grown to be useful even outside of Selenium. For example, Appium is a test automation framework that leverages the WebDriver protocol. It supports app automation across a variety of mobile platforms, such as iOS, Android, and Windows. Appium also has added full W3C specification support, starting with version 1.9.

Major Advantages of the WebDriver W3C Protocol

  • The automated Selenium testing will run more consistently across browsers as the browsers, and Selenium WebDriver is using the same protocol.
  • With WebDriver W3C Protocol, automated Selenium testing will be less flaky and more stable. Stability in tests is a major reason to shift to Selenium 4.
  • Actions API in WebDriver W3C Protocol are richer in comparison to the one in JSON Wire Protocol. The Actions API is revamped to conform with the WebDriver Spec. Action APIs would now let you perform multi-touch actions, zoom-in, zoom-out, pressing two keys simultaneously, and more.
    For example, the Pinch-zoom sequence in W3C Protocol is represented by an action sequence consisting of three ticks and two-pointer devices of type-touch.
  • Standardization of W3C opens up opportunities for promoting compatibility beyond WebDriver API implementations.
  • Websites with W3C compliance help in reducing the maintenance efforts, as cleaner code results in improved readability.



Summing-up, the implementation of the W3C protocol should not generate major problems. On the contrary, the new protocol is expected to obtain great benefits in terms of the consistency and stability of the tests in different browsers. Furthermore, the WebDriver API will be updated, adding modern actions. It is important to emphasize that Selenium 4 is still in an alpha version.