Selenium 4 – New Features (W3C Standardized WebDriver Architecture and Relative Locators)

Selenium 4 – New Features (W3C Standardized WebDriver Architecture and Relative Locators)

Selenium 4 – New Features (W3C Standardized WebDriver Architecture and Relative Locators)

Before, I walk you through the new features of Selenium 4, let me explain the current status of Selenium and its market share.

Selenium Market Share in 2022

Selenium is still the number one in the market and is majorly used for automating the web applications. Despite of being free, it has 81% market share in web automation market (Reference –

All this is possible for Selenium, because of the below reasons:

  1. Selenium is free
  2. Selenium is open source
  3. Selenium is powerful despite of being free
  4. Selenium has large community support

What is the Official Release Date of Selenium 4?

Everyone is very curious and eagerly waiting for the official release of Selenium 4 from the past 2 years. In August 2018, Simon Stewart (Founding member of Selenium) has publicly announced about its release by the end of the year 2018. Its June 2021 when I am writing this article and still the stable version of Selenium 4 is not released.

Even though the stable version of Selenium 4 is not released into the market as of today, but we can see a lot of alpha and beta versions of Selenium 4 available in the maven repository here –

By looking at the number of beta versions at the above maven repository, we can roughly guess that the stable version of Selenium 4 is near by and may be released by the end of this 2021 year.

What are the new features of Selenium 4?

While Selenium 4 is taking long time to get stable and get released into the market, few of the new features which were planned for Selenium 4 are already provided in the latest stable versions of Selenium 3. The below are the new features that are coming up or orginally planned for Selenium 4:

  1. W3C Standardization
  2. Relative Locators
  3. Selenium Grid 4
  4. Selenium IDE TNG
  5. Taking Screenshots at Element level
  6. Interaction with DevTools
  7. And many more

In this session, I am going to explain about the W3C Standardization and Relative Locators only.

Selenium WebDriver – W3C Standardization

Selenium WebDriver is now W3C standardized.

First of all, what is this W3C?

W3C stands for Wold Wide Web Consortium. W3C is an internal community which develops standards for the web, so that every web developer in the world follows these same standards while developing their applications/software. Find more information about these W3C here –

When Selenium WebDriver got W3C standardized?

W3C standardization was intially amied for Selenium 4 stable version, but as this verion is taking long time and not yet released it to the market, the Selenium team has made Selenium WebDriver W3C standardized from Selenium 3.8 version onwards. Now, the latest stable version of Selenium WebDriver for Java is 3.141.59 as of June 13th, 2021 and is W3C standardized.

How was the earlier Selenium WebDriver Architecture implemented before it was standardized to W3C?

Earlier versions of Selenium i.e. the versions that are less than 3.8, have not followed the W3C Standards. The older versions of Selenium has used JSON Wire Protocol instead. The below diagram depicts the older versions of Selenium that has used JSON Wire Protocol in the WebDriver architecture:

WebDriver Archtiecture - JSON Wire Protocol
WebDriver Archtiecture – JSON Wire Protocol

As depicted in the above image, Selenium Automation scripts were using JSON Wire proctol for communicating with the different drivers of browsers. And these drivers were communicating with the respective browsers and executing the instructions receieved from the Automation scripts on these browsers.

What changed in the above WebDriver Architecture as part of W3C Standardization?

In upcoming Selenium 4 release, the W3C Protocol is going to replace the JSON Wire protocol. In the current versions of Selenium 3 from 3.8 versions onwards till 3.141 versions, W3C Protocol is used along with the existing JSON Wire protocol. But when the stable version of Selenium 4 is released, JSON Wire Protocol will be completely dropped and only the W3C Protocl will be used in place of JSON Wire Protocol as part of W3C Standardization. The below diagram depicts the Selenium 4 WebDriver Architecture:

WebDriver Archtiecture - W3C Protocol
WebDriver Archtiecture – W3C Protocol

What are the benefits when Selenium is W3C Standardized?

The below are the benefits of Selenium W3C Standardization:

  1. Benefit#1 – Standardization – Since most of the things on Web like different Browsers, Browser drivers are already W3C standardized, if Selenium is also W3C standardized, then the communication between the Selenium, Drivers and Browsers will become easier, as everyone is a common protocol for communication i.e. W3C. Its like two people communicating in the same language.
  2. Benefit#2 – Stability of Automation Scripts – Earlier before the W3C Standardizatio, the Selenium Automation scripts working for a browser, used to fail in other browsers. But now because of the W3C Standardization of Selenium, this problem got resolved. No need to customize the automation script for different browsers, due to W3C Standardization of Selenium.
  3. Benefit#3 – Advanced Operations by Selenium are possible on Browsers  now- For example, after W3C standardization of WebDriver, we can now use Actions class to press two keys simulatenous.

What about the W3C WebDriver standardization impact on Mobile Automation using Appium, as Appium is built on the top of Selenium WebDriver by leveraging the WebDriver protocol?

As Appium is also W3C standardized from version 1.9 onwards, Appium can leverage the WebDriver protol in a better way, as WebDriver is also W3C standardized now.

Is only WebDriver component of Selenium, W3C Standardized?

No. All the current components of Selenium i.e . Selenium IDE, Selenium Grid are also W3C Standardized along with Selenium WebDriver component.

Will be there any changes in the way, we have to write the automation code, due to the Selenium WebDriver W3C Standardization change?

The answer is simply No. As these W3C Standardization changes for WebDriver are happening at the architectural levels, it won’t affect the current Selenium WebDriver API commands like get, sendKeys() etc. Only we can see the new deprecations (i.e. outdations) of commands and new additions of Selenium WebDriver commands.

Now, lets move on to the next new Feature of Selenium 4 i.e. Relative Locators.

Selenium WebDriver – Relative Locators

Relative Locators, also  known as Friendly Locators are introducted in Selenium 4. If you want to try them now, you don’t have to  wait till the Selenium 4 stable release, instead you can download the latest alpha version of Selenium 4 and try it on your own.

But, what exactly are these Relative Locators?

If we are unable to locate a particular UI element on a page due to its dynamic nature etc., we can take the help of locating it using its near by UI elements. For example, if you are not able to locate the ‘Login’ button on the facebook Login page (i.e. Open in incognito mode in any browser say Chrome), then using Relative Locators concept in Selenium 4, we can locate the ‘Login’ button using the near by element on the page i.e. ‘Password’ text field.

Here is an example code which is using the Selenium WebDriver Lastest Alpha version, as part of Relative Locators implementation:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import io.github.bonigarcia.wdm.WebDriverManager;

public class Demo {

	public static void main(String[] args) {
		WebDriver driver = new ChromeDriver();
		WebElement searchButton = driver.findElement(RelativeLocator.withTagName("input").toRightOf("q")));;



Watch the below video to understand Relative Locators in a practical way:

The below are the different Relative Loctors that are currently available in the latest Alpha versions of Selenium 4:

  • above – Helps in locating the UI element that is above the given locator
  • below – Helps in locating the UI element that is below the given locator
  • to_left_of – Helps in locating the UI element that is to the left of the given locator
  • to_right_of – Helps in locating the UI element that is to the right of the given locator
  • near – Helps in locating the UI element that is near to the give locator (i.e. 50 pixels away)

Other new feature of Selenium 4:

There are other new features going to be introduced in Selenium 4. If you are want to learn all the new features of Selenium 4 in detail, watch the below Youtube playlist having a set of videos:


Stable version of Selenium 4 is not yet released into the market. There are many new features in Selenium 4 and the major one is W3C standardizationn. Apart from this Relative Locators feature is already introduced in the Alpha release of Selenium 4 and is available for us to try. I will keep updating this article, based on the Selenium 4 updates going a head.

Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *

For FREE Testing Tutorials & Videos

Open chat
Contact Us on Whatsapp