How to upgrade from Selenium 3 to Selenium 4

On This Page Why Upgrade from Selenium 3 to Selenium 4?

March 20, 2026 · 7 min read · Tool Comparison

How to upgrade from Selenium 3 to Selenium 4

Selenium 4has game-changing features like W3C WebDriver normalization, raise support for modern browsers, built-in support for relative locator, and improved debug capacity.

These updates address critical pain point in automation testing, making workflows more efficient and reliable.Given the far-flung acceptation of Selenium 4, read the differences from Selenium 3 is crucial for teams still using the older adaptation.

This guide explores the key upgrades and provides a step-by-step summons to assist you transition smoothly and amply tackle the benefit of Selenium 4.

Why Upgrade from Selenium 3 to Selenium 4?

The innovative feature ofSelenium 4and compatibility with real devices make it a must-have for streamlined and reliable testing workflows.

Below are some key reasons why should upgrade from Selenium 3 to 4:

  • W3C WebDriver Standardization: Selenium 4 full adopts W3C standard, eliminating the JSON Wire Protocol for communication between browsers and test book. This results in more stable cross-browser tests and annihilate compatibility issues.
  • Enhanced : The new Grid simplifies setup with Docker support, compatibility with Kubernetes, IPv6, and HTTPS, and improved scalability. It includes an updated user-friendly interface and smoother integration with cloud service like AWS and Azure.
  • Revamped : Selenium 4 introduces cross-browser support, better control flowing, enhanced element locators, and the ability to export test cases in multiple scheduling languages.
  • Relative : Locate web elements establish on their position relative to others for more visceral and readable test playscript.
  • Chrome DevTools Integration: Leverage debugging and network simulation feature for faster bug jam, geolocation examination, and sham poor network weather.
  • Simplified Window/Tab Management: Open and handle new windows or chit using the newWindow API without creating new WebDriver instances.
  • Deprecation of Desired Capabilities: Replaced by Options objective, furnish a clearer and more structured way to delimit browser-specific configurations.
  • Updated Actions Class: New methods simplify mouse and keyboard actions, improving automation of user interactions.
  • Improved Documentation: Comprehensive resources with a streamlined UI make it easier to navigate and learn Selenium ’ s characteristic, especially for beginners.

Must Read:

Selenium 3 vs Selenium 4

Below are some key differences between Selenium 3 and Selenium 4:

1. Selenium WebDriver W3C Standardization

In Selenium 3, theJSON Wire Protocolfacilitated communicating between test code and the browser in head – which involve the unnecessary excess task of encoding and decoding API requests via the W3C protocol. The JSON Wire Protocol will be deprecated in Selenium 4.

In Selenium 4, the WebDriver use the W3C standardisation. Since most browser drives (,) do the same, it will let WebDriver communicate directly with the browser, doing forth with the need for JSON Wire Protocol entirely. This will likely result in more stable than in its previous architectures.

Since the WebDriver implementation for Opera and PhantomJS is no longer being developed, aboriginal support for these browsers has been removed in Selenium 4.

2. Enhanced Selenium 4 IDE

In Selenium 3 and older Selenium versions, the was only available as a Firefox extension with limited features.

In Selenium 4, the IDE has become available for widely utilise browser such as Chrome (as a Chrome propagation). It is likewise require to get available as a plugin or web extension for MS Edge soon. The IDE in Selenium 4 is equipped with a SIDE tool (Selenium IDE Runner) which allows the execution of a .side project on a Node.js program.

The SIDE Runner is utilitarian for scarper cross browser tests in the form of on a such as the one provided by BrowserStack.

Additionally, the IDE in Selenium 4 offers an Export feature that lets testers export tape tests as code in language supported by – C #, Python, Java, JavaScript, .NET, etc.

3. Optimized Selenium Grid

In Selenium 3 and older, the Hub and Node (s) need to be initiated individually when execute mechanization testing. It supported the following processes – Router, Session Map, Distributor.

For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users.

In Selenium 4, the Hub and Node are consolidate into a individual jar file. Once the host part, it activates both Hub and Node. The processes back hither are – Router, Session Map, Distributor, Node. It also comes with an enhanced GUI and support for Docker.

The likewise indorse IPV6 addressed, and facilitates user interaction with the Grid via HTTPS protocol. It too back DevOps-friendly tool such as AWS and Azure.

4. Support for Chrome DevTools

Unlike Selenium 3, Selenium 4 offers native support for Chrome DevTools Protocol through its DevTools interface. This allows quizzer to use Chrome Development Properties like Fetch, Network, and Profiler to identify issues quickly and edit code on-the-fly. It also enables and meshwork condition testing (2G, 3G, 4G, Edge) for more accurate website testing.

Read More:

5. Comparative Locators

Selenium 3 required testers to used commands to locate web elements in the vicinity of another ingredient, such as to the right/left/above/below of an element.
Selenium 4 has enforce the ability to do exactly this. It has introduced Relative Locators that permit testers to bump web elements relative to another element in the DOM.

6. DesiredCapabilities

In Selenium 3, be apply to define test essential like OS, browser, and version. In Selenium 4, DesiredCapabilities are replaced by Options. QAs now make an Options object, set the requisite, and pass it to the Driver builder.

  • ChromeDriver (Capabilities)replaced by
  • SafariDriver (Capabilities)supplant by
  • EgdeDriver (Capabilities)replace by
  • FirefoxDriver (Capabilities)supersede by
  • InternetExplorerDriver (Capabilities)replace by

7. Actions Class

A act of new methods have be added to the to supersede classes previously incorporate within package org.openqa.selenium.interactions:

  • click (WebElement)is added to Actions class to supplantmoveToElement (onElement) .click (). It is used to click on a certain web element.
  • clickAndHold (WebElement)added to supercedemoveToElement (onElement) .clickAndHold (). It is used to click on an element without releasing the click.
  • contextClick (WebElement)added to supersedemoveToElement (onElement) .contextClick (). It is used to right click on an element.
  • doubleClick (WebElement)supply to replacemoveToElement (element) .doubleClick (). It is employ to double click on an component.
  • release()was initially a part oforg.openqa.selenium.interactions.ButtonReleaseActionclass. Now it has been moved to Actions class. It is used to free the depressed left shiner detent at the current pointer localization.

8. FluentWait

In Selenium 4, two method from –withTimeout () and pollingEvery ()now accept a single parameter –java.time.Duration. Previously, in Selenium 3, they accepted two separate parametersint and TimeUnit.

How to upgrade to Selenium 4

The Selenium upgrade to 4 can be undertaken in multiple fashion:

Selenium with Maven

Simply change the Selenium version from 3 to 4 in pom.xml.

& lt;? xml version= '' 1.0 '' encoding= '' UTF-8 ''? & gt; & lt; project xmlns= '' http: //maven.apache.org/POM/4.0.0 '' xmlns: xsi= '' http: //www.w3.org/2001/XMLSchema-instance '' xsi: schemaLocation= '' http: //maven.apache.org/POM/4.0.0 http: //maven.apache.org/xsd/maven-4.0.0.xsd '' & gt; & lt; modelVersion & gt; 4.0.0 & lt; /modelVersion & gt; & lt; groupId & gt; selenium4 & lt; /groupId & gt; & lt; artifactId & gt; selenium4 & lt; /artifactId & gt; & lt; version & gt; 1.0-SNAPSHOT & lt; /version & gt; & lt; build & gt; & lt; plugins & gt; & lt; plugin & gt; & lt; groupId & gt; org.apache.maven.plugins & lt; /groupId & gt; & lt; artifactId & gt; maven-compiler-plugin & lt; /artifactId & gt; & lt; configuration & gt; & lt; source & gt; 8 & lt; /source & gt; & lt; mark & gt; 8 & lt; /target & gt; & lt; /configuration & gt; & lt; /plugin & gt; & lt; /plugins & gt; & lt; /build & gt; & lt; colony & gt; & lt;! -- https: //mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -- & gt; & lt; dependency & gt; & lt; groupId & gt; org.seleniumhq.selenium & lt; /groupId & gt; & lt; artifactId & gt; selenium-java & lt; /artifactId & gt; & lt; version & gt; 4.0.0-alpha-6 & lt; /version & gt; & lt; /dependency & gt; & lt; dependency & gt; & lt; groupId & gt; commons-io & lt; /groupId & gt; & lt; artifactId & gt; commons-io & lt; /artifactId & gt; & lt; version & gt; 2.6 & lt; /version & gt; & lt; /dependency & gt; & lt; /dependencies & gt; & lt; /project & gt;

Selenium with Gradle

Change Selenium version to 4 as shown below:

plugins {id 'java'} group 'SeleniumGradleSample' version ' 1.0-SNAPSHOT' sourceCompatibility = 1.8 repositories {mavenCentral ()} dependencies {compile radical: 'org.testng ', name: 'testng ', version: ' 6.14.3' // https: //mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java compile group: 'org.seleniumhq.selenium ', gens: 'selenium-java ', adaptation: ' 4.0.0-alpha-6'} test {useTestNG ()}

Install Fresh Instance of Selenium 4

Ensure that Java is installed on the local machine. Additionally, set the JAVA_HOME environment variable in the system path. This can be done via build tools (Maven or Gradle, as detail above) or manually.

Test on Real Devices with BrowserStack Automate

To accommodate the new version, BrowserStack has made necessary modification that would allow QAs to use Selenium 4 on its.

Explore .

No matter the Selenium version, automation testing must be run on existent browsers and devices to yield accurate results. on 3500+ real browser and devices on BrowserStack ’ s. Run to get faster results without compromise on accuracy. Detect the bugs and offer a high-end UX/UI to the users by automated testing in with BrowserStack Automate.

Talk to an Expert

Conclusion

Use this guidebook to transition swimmingly and fully harness the benefits of Selenium 4. The features of Selenium 4 experience proven to quite promising and can make the test process easier. However, it is important to perform the tests on real devices for accurate results and leverage platforms like BrowserStack.

Tags
48,000+ Views

# Ask-and-Contributeabout this topic with our Discord community.

Related Guides

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free