Fundamentals 6 min read

Key New Features and Differences of Selenium 4

This article introduces Selenium 4's major enhancements—including W3C standardization, an upgraded IDE, a unified Grid architecture, native Chrome DevTools support, relative locators, and additional APIs—while comparing them to Selenium 3 and providing practical usage examples.

FunTester
FunTester
FunTester
Key New Features and Differences of Selenium 4

Since its 2018 release, the Selenium framework’s latest version Selenium Selenium 4 has become a hot topic; although the final version has not been officially announced, users and test‑automation enthusiasts are already exploring it through the Selenium 4 Alpha releases.

Selenium supports many programming languages such as Java, C#, Python, JavaScript, Ruby, and PHP, and this article shares practical experiences based on the Selenium 4.0.0-alpha-7 version.

Selenium 4 Differences

W3C Standardization

In Selenium 3 the JSON Wire Protocol was the primary communication method between test code and web browsers, and drivers like ChromeDriver and GeckoDriver followed that protocol. Selenium 4 adopts the W3C protocol, allowing drivers to encode and decode requests according to the W3C standard, eliminating the overhead of JSON Wire Protocol encoding/decoding and making cross‑browser testing more stable.

Selenium 4 IDE

The Selenium 4 IDE is more than a simple record‑and‑play tool; it works with Firefox and as a Chrome extension, and includes the SIDE Runner to run tests in parallel on local or cloud Selenium Grid . Its export feature can generate test code in supported languages such as Python, C#, Java, etc., making the IDE a powerful addition to Selenium 4.

Selenium Grid

For Selenium 3 users, starting a Hub and a Node.jar for distributed testing was cumbersome. Selenium Grid 4 consolidates Hub and Node into a single jar , offering a more scalable and traceable architecture with four processes—router, session map, distributor, and node. Built‑in GUI and Docker support provide extra convenience.

Chrome DevTools

Selenium 4 natively supports the Chrome DevTools Protocol (CDP) via the DevTools API, simplifying debugging, page editing, and allowing simulation of geolocation and network conditions (e.g., 3G, 4G) for testing web products across different environments.

Relative Locators

Selenium 3 required explicit WebElement searches to locate nearby elements, lacking shortcuts for elements above, below, or to the side. Selenium 4 Alpha introduces relative locators (above, below, right, left, near) that enable locating elements relative to a specific DOM element.

More Things

TakeElementScreenshot API can capture screenshots of specific WebElement instances.

newWindow API simplifies creation of new windows ( WindowType.WINDOW ) or tabs ( WindowType.TAB ).

Various optimizations improve and accelerate the debugging process.

Overall, the Selenium 4 Alpha experience is superior to Selenium 3, offering a richer feature set and smoother automation workflow.

Have Fun ~ Tester!

FunTester is a group of enthusiastic testers, certified by Tencent Cloud & Boss, and an official media partner of GDevOps.

TestingIDEW3CSeleniumWeb AutomationgridRelative Locators
FunTester
Written by

FunTester

10k followers, 1k articles | completely useless

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.