Selenium 4 and 4.1 introduce significant advancements across WebDriver, IDE, and Grid, streamlining web automated testing processes. These releases deliver a W3C standardized architecture, enhanced locator strategies, improved parallel testing capabilities, and robust deployment options, fundamentally transforming quality assurance practices for greater efficiency and flexibility.
Adopt W3C Standardization and Advanced WebDriver Features: Leverage the W3C compliant WebDriver APIs for direct browser communication, eliminating the legacy JSON wire protocol. Utilize new relative locators like above() or near() and the unified By instance for more intuitive and stable element identification, alongside improved window/tab management and network condition emulation.
Utilize Selenium IDE's Enhanced Capabilities: Employ the revamped Selenium IDE, which now supports parallel test execution via the Node.js-based Selenium-side-runner CLI. Export recorded tests to various language bindings (Java, Python, C#, .NET, JavaScript) and benefit from backup element selectors for creating more stable and maintainable scripts.
Optimize Infrastructure with Selenium Grid 4: Deploy Selenium Grid 4 on Kubernetes-based infrastructures for scalable and flexible test environments, benefiting from its new GraphQL model for improved querying and management. Automate on-demand Docker container spin-ups to reduce maintenance efforts and eliminate the need for traditional virtual machines.
The first-ever release of Selenium WebDriver 1.0 in 2007 has indented a lasting footprint in web automated testing. And through the years, the contributions of the Selenium project (WebDriver, Grid, and IDE) have truly transformed the way that we do quality assurance.
Fast forward to the ‘drop-in’ release of Selenium 4 and Selenium 4.1, this article narrows down the top 5 changes you need to know for WebDriver, IDE, and Grid.
Cross-browser testing has received an efficiency boost from the updates in Selenium’s architecture.
The WebDriver APIs have removed the support for the legacy protocol and are fully compliant with the W3C Standardization. Allowing browsers and test scripts to communicate straight to the targeted browsers, users no longer have to go through the JSON wire protocol to encode and decode API requests.
For those that still have the ChromeDriver and GeckoDriver browser drivers in use, this standardization will not cause any effects since they have already supported the W3C protocols.
To reassure you, using the W3C WebDriver will not cause any harm to existing users. The main changes only evolve around Capabilities and the Actions class.
Adding and deleting WebDriver APIs
FindsByID, FindsByCss or related FindsBy* (findElementBy) interfaces have been removed and replaced with ‘By’ instance.
Before
driver.findElementByCssSelector(".className");
driver.findElementById("elementId");
driver.findElementByXPath("xPath");
After
driver.findElement(By.cssSelector(".className"));
driver.findElement(By.id("elementId"));
driver.findElement(By.xpath("xPath"));
Relative Locators or Friendly Locators. Names such as above(), below(), toLeftOf(), toRightOf() and near() look to provide an easier way to spot elements that are close to the other DOM elements.As opposed to this, Selenium 4 also introduced new elements such as:
Exceptions set to understand test failures. 'ElementClickInterceptedError', 'InsecureCertificateError', 'InvalidCoordinatesError', and 'NoSuchCookieError' classes are included in /lib/error.
Chrome Debugging/DevTools Protocol (CDP) integration. Cross-language APIs are still under development to extend coverage for requirements like log captures or geolocation mocking
Sample code snippet to open a new window
driver.get("https://www.katalon.com/");
// Opens a new window and switches to new window
driver.switchTo().newWindow(WindowType.WINDOW);
// Opens Katalon Academy homepage in the newly opened window
Emulate different network conditions. The Network.emulateNetworkConditions command helps compare the average loading time by scripting tests that emulate a range of network speed (slow and normal) and connection type (BLUETOOTH, 2G, 3G, 4G, WIFI, etc.).
Selenium IDE
The following are the updates Selenium 4 has added to Selenium:
Revived UI
Plug-ins to fully support Chrome, Firefox, or any other web extension plugins
Parallel testing by switching from being HTML-based to running on a NodeJs platform with the “Selenium-side-runner” CLI runner
Improve scripts written using “while” and “if” conditions
Allows the recorded tests to be exported in Java, C#, Python, .NET, and JavaScript language binding
Backup element selector and updated locator strategies to create more stable tests
Less maintenance work with standalone Firefox server to get Docker images
On-demand Docker containers spin-ups without setting up virtual machines
The release of Selenium Grid 4.1 can be read in detail here.
Loving Selenium? Give Katalon Studio a Try Too!
As a legacy library, manytest automation tools have used Selenium as a base to develop a complete framework that is ready to work with right away. For Katalon Studio, it’s no exception.
Built on top of Selenium and Appium, Katalon Studio is an all-in-one solution for web, mobile, API, and desktop (Windows) low-code test automation. What makes Studio different from open-source libraries is everything is baked-in into a single tool for users to only focus on testing. This means that teams no longer have a dedicated team to build and maintain their own test automation framework, or to have a strong foundation in programming to start testing.
Any activities relating to creating, executing, maintaining, or generating reports for your tests can be done right away without extra coding or configuration with 3rd-party tools.
Some of Studio’s highlights are:
Native integrations with CI/CD, ALMs, Agile, and DevOps systems (e.g. Jira, Jenkins, CircleCI, Dockers, Kubernetes, etc.)
Flexible and fast test creation with Record and Playback, Manual and Script Mode
Debugging UI and smart reporting to troubleshoot failed tests
Support imports of Selenium, SoapUI, and Postman projects
Page Object Model (POM) design and Test Artifact Sharing to reuse test artifacts (test cases, objects, keywords, etc.)
Supported testing methodologies: BDD, DDT, Keyword-Driven Testing, Cross-Browser Testing (Headless, Chrome, Edge, Firefox, and Safari), and Cross-Platform Mobile Testing (iOS, Android)
The Katalon Team is composed of a diverse group of dedicated professionals, including subject matter experts with deep domain knowledge, experienced technical writers skilled, and QA specialists who bring a practical, real-world perspective. Together, they contribute to the Katalon Blog, delivering high-quality, insightful articles that empower users to make the most of Katalon’s tools and stay updated on the latest trends in test automation and software quality.
on this page
Test with Katalon
Write and run automation tests across thousands of environments.