What is new in Selenium 4 ?

Selenium has gone through a tremendous evolution since its introduction and that’s the reason today it is the most popular and powerful automation testing tools. The newly released Selenium 4 is creating a lot of buzz and the complete testing community is looking forward to exploring its updated features. Before we dive into Selenium 4, let’s have a brief introduction on its previous versions. Selenium 1 was declared as the free open source automation testing framework in the year 2004 consisting of selenium IDE, RC and webdriver. Whereas, the Selenium 2 released in 2011 consisted of the IDE, Web driver and Grid. The RC server was merged with the web driver, as the web driver facilitated easy automation scripting for the browsers. Selenium 3 was officially released in 2016. One of the most noticeable change in selenium 3 was the replacement of the selenium core with the webdriver backed option, the introduction of the gecko driver and W3C webdriver integration.

With the aim of executing much seamless,accurate and faster test automation, Selenium 4 was released on 24th April 2019. So let’s unleash all the major features of selenium 4 which sets it apart from the earlier versions delivering better test automation. There are a lot of exciting features in Selenium 4 across the complete suite i.e. Selenium IDE, Webdriver and Grid. In Selenium 4 though the Webdriver captures the spotlight, we will cover the updated features of selenium IDE and selenium grid. So first of all let’s define the different user groups for the Selenium suite.

Selenium is a suite of tools which caters to the various requirements of the project.

Let us explore the features of Selenium 4 across the different Selenium Tools

  • A new UI for better user experience
  • As mentioned earlier it will be available in Firefox as well as the Chrome browser through the web-extension plugin. In fact almost all the browsers support the new selenium IDE and as per the information it will be available in MS Edge store.
  • Code export will be available in almost all the programming languages like Java, Python, Ruby, .Net, Javascript etc
  • The new Command Line Runner (CLI Runner), called the Selenium Side Runner, runs based on NodeJs and not the old HTML based runner will have the following capabilities. Webdriver playback , the new CLI runner will be completely based on the web driver. It will support parallel execution and provide useful information like time taken, the number of test cases passed or failed.

Selenium IDE

Selenium Webdriver

The Selenium Webdriver features which brought significant change in the Selenium 4 are as follows :

Relative Locators

Tools like Sahi and Taiko have features to locate the nearby elements by specifying the directions, however to accomplish the same in the selenium we need to deal with the complicated xpaths and css locators which might result in brittle or flaky test cases.

The relative locators in selenium 4 provide a better solution by helping us to locate the elements based on their positions with respect to other elements.


Relative locators provide a newly added locator strategy to the existing eight locator strategies.(id, name, XPath, cssSelector, linkText, partial LinkText, className, and tagName). Relative locators locate the element with respect to the nearby specified elements.


A new method withTagName() is added, which returns an instance of RelativeLocator.RelativeBy class, a child class of By and offers methods to specify the direction of an element to be located.


Used to locate an element just above the specified element


Used to locate an element just below the specified element


Used to locate an element located on the left side of a specified element

Used to locate an element located on the right side of a specified element

By default, it is used to locate an element at 50 pixels distant from a specified element.

These five relative locators, when added to the existing eight locator strategies, help to get more accurate results for locating the elements, eventually saving from creating flaky test cases.

Windows and Tabs Management

The WindowType. Window and WindowType.Tab will help you to select a new window or a new tab without giving a new driver reference.

This is a great feature provided by the selenium 4 webdriver wherein one can work on multiple windows and tabs in the same test without using multiple driver references.

Chrome DevTool Integration

  • Mock geolocations for location-aware testing, localization, and internationalization
  • Change the device mode and exercise the responsiveness of the application

One of the most anticipated features for Selenium 4 is the new API’s in the Chrome DevTools Protocol. As we know the Chrome DevTools is a set of tools built directly in the chrome based browsers like the Chrome Opera and Microsoft Edge to help the developers debug and investigate the websites.

Selenium 4 enables developers to perform all the Chrome DevTools functions by adding native support for the Chrome DevTools API. These new API’s enable to perform the following functions:

Apart from this, the Selenium 4 introduced the new Chromium Driver Class which includes the two methods to access the Chrome DevTools: getDevTools() and executeCdpCommand()

Hence Selenium 4 enables to programmatically access the chrome dev tools, unlike the other versions of selenium, Selenium 4 enables access the Chrome devtools to invoke its various functionalities and reap its benefits like simulating the network speed, mocking the geo locations, accessing the console logs, capturing the performance metrics, bypassing the pops for authentication through CDP API’s, etc.

  • Selenium Grid deployment has been enhanced for more scalable and traceable infrastructure.
  • Users can deploy the grid either as a standalone grid, hub — node or deploy it in a distributed mode with different processes like in the below picture.
  • Observability is a way of measuring a system’s internal state. This capability helps us trace what happens when an API is invoked or a new session creation is requested. This will help the admins and developers in analysing the root cause when strange problems arise.
  • In Selenium 4 the grid communication can happen through the HTTP protocol
  • Other new features to be planned in Selenium 4 are A revived UI for Grid, Console, GraphQ for querying the grid, more work on Grid Stability and Resilience.

Selenium Grid


Originally published at https://www.pcloudy.com.

pCloudy is the most powerful cloud-based App Testing Platform. Brand Marketing @ pCloudy (www.pcloudy.com)

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store