Selenium 4 is a major leap forward in the world of web automation testing. Since its early beta in 2020 and official release in 2021, it has continued evolving with several minor and stable updates. Whether you’re a beginner or an experienced tester, understanding Selenium 4’s new features can supercharge your automation strategy.
In this blog, we’ll explore all the major updates, enhancements, and deprecations in Selenium 4 up to June 2025.
🔹 W3C WebDriver Compliance
✅ What’s New?
- Selenium 4 uses the W3C WebDriver standard by default.
- It replaces the outdated JSON Wire Protocol.
🟢 Benefits:
- Better cross-browser compatibility.
- More reliable communication between Selenium and browsers.
- Cleaner, standardized command structure.
⚠️ JSON Wire Protocol is now deprecated.
🌐 Selenium Grid 4 – Built for Scalability
✅ Major Changes:
- Unified architecture: Run Grid in one line using
standalone
mode. - Modern UI Dashboard: Monitor sessions visually at
http://localhost:4444/ui
. - Cloud-native: Supports Docker, Kubernetes, and TOML config.
🚀 Great for teams running parallel tests across environments.
🔐 Selenium IDE – Record & Playback Reimagined
✨ Now supports:
- Chrome, Firefox, Edge.
- Control flows:
if
,else
, loops, etc. - Export tests to Java, Python, JS, C#, and more.
- Run tests in parallel using SIDE Runner CLI.
- Extend with custom plugins.
Perfect for beginners and quick prototyping!
🔎 Relative Locators – Visual Element Selection
Find elements based on visual position.
WebElement label = driver.findElement(By.id("username-label"));
WebElement field = driver.findElement(RelativeLocator.with(By.tagName("input")).below(label));
📍 Available Methods:
above()
below()
toLeftOf()
toRightOf()
near()
Cleaner, human-readable alternative to long XPath queries!
🛠️ Chrome DevTools Protocol (CDP) Integration
Gain deeper control with Chrome & Edge:
- Inspect console logs
- Simulate geolocation/network throttling
- Capture network requests/responses
DevTools devTools = ((ChromeDriver) driver).getDevTools();
devTools.createSession();
devTools.send(Network.enable(...));
⚡ Best suited for performance and debugging tests.
🌐 New Tab & Window Support
No more juggling window handles!
driver.switchTo().newWindow(WindowType.TAB);
driver.get("https://example.com");
Makes OAuth and multi-tab testing easier than ever.
📷 Capture Element Screenshots
Take screenshots of specific elements for reporting:
WebElement el = driver.findElement(By.id("captcha"));
File file = el.getScreenshotAs(OutputType.FILE);
Useful for debugging and visual test evidence.
🚒 Selenium Manager (From v4.6)
No more downloading drivers manually!
WebDriver driver = new ChromeDriver();
// Automatically manages ChromeDriver setup
Supports: Chrome, Firefox, Edge
Great for CI/CD and new users.
🌟 Improved Actions API
✅ New methods like:
.click(element)
.doubleClick(element)
.dragAndDrop(source, target)
.pause(Duration.ofSeconds(2))
🌿 More readable, smoother interaction chains.
❌ Deprecated Features (and What to Use Instead)
❌ Deprecated | ✅ Use Instead |
---|---|
DesiredCapabilities | ChromeOptions , FirefoxOptions |
findElementBy...() | findElement(By...) |
PhantomJS, Opera Drivers | Use headless Chrome/Firefox |
EventFiringWebDriver | Use custom logging/wrappers |
📆 Version-by-Version Highlights
- v4.0 (2021): W3C, Grid redesign, CDP, IDE reboot.
- v4.6 (2022): Selenium Manager beta.
- v4.11 (2023): Support for Chrome-for-Testing.
- v4.30–4.33 (2024–25): Grid UI updates, BiDi expansion.
🌟 Final Thoughts
Selenium 4 is modern, smart, and stable. It simplifies browser testing, reduces setup overhead, and unlocks features like:
- Native driver handling
- Advanced browser controls via CDP
- Friendly element locators
- A better Selenium Grid experience
If you’re still on Selenium 3 — now’s the time to upgrade.