The Release of Selenium 4 (and 4.1) | Top Features to Look Into
Tags: selenium4, selenium41, seleniumide, testautomationtools
Published: 2021-11-29 07:10:29

---
title: The Release of Selenium 4 (and 4.1) | Top Features to Look Into
published: true
date: 2021-11-26 05:45:52 UTC
tags: selenium4,selenium41,seleniumide,testautomationtools
canonical_url: https://www.katalon.com/resources-center/blog/selenium-4-features/
---

![Selenium 4](https://d1h3p5fzmizjvp.cloudfront.net/wp-content/uploads/2021/11/Selenium-4.png)

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.

> ![🚨](https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f6a8.png) Release ![🚨](https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f6a8.png)
> 
> ![🎉](https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f389.png) ![🎉](https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f389.png) Selenium 4.0 is here! ![🎉](https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f389.png) ![🎉](https://s.w.org/images/core/emoji/12.0.0-1/72x72/1f389.png)
> 
> Read all about in our blog post:[https://t.co/E8ntH7OdaB](https://t.co/E8ntH7OdaB)
> 
> We hope you enjoy Selenium 4, and we can’t wait to see what you do with it! [#selenium4](https://twitter.com/hashtag/selenium4?src=hash&ref_src=twsrc%5Etfw)
> 
> — Selenium (@SeleniumHQ) [October 13, 2021](https://twitter.com/SeleniumHQ/status/1448289975062220808?ref_src=twsrc%5Etfw)

<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

## **Selenium WebDriver 4 **

### **W3C Standardization**

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](https://www.selenium.dev/documentation/getting_started/how_to_upgrade_to_selenium_4/)** 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**](https://www.selenium.dev/documentation/webdriver/locating_elements/) 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)](https://www.selenium.dev/documentation/support_packages/chrome_devtools/) integration. Cross-language APIs are still under development to extend coverage for requirements like log captures or geolocation mocking**
- **[Chrome Debugging/DevTools Protocol (CDP)](https://www.selenium.dev/documentation/support_packages/chrome_devtools/) 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

driver.navigate().to(“https://www.academy.katalon.com/”);

 |

**Sample code snippet to open a**  **new tab**  **within the same window**

| driver.get(“https://www.katalon.com/”);

// Opens a new tab in existing window

driver.switchTo().newWindow(WindowType.TAB);

// Opens Katalon Download page in the newly opened tab

driver.navigate().to(“https://www.katalon.com/download/”); 

 |

- **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

_Maybe you also want to try **[the best Alternative for Selenium IDE ](https://www.katalon.com/katalon-recorder-ide/)**_

## **Selenium Grid 4**

Taking pointers and learning from the success of the Zalenium and Selenoid projects, 

Selenium Grid most notable change is being able to: 

- Implemented a GraphQL model for a new UI to better query and manage Grid
- Support deploying on **[Kubernetes-based](https://github.com/manoj9788/kubernetes-docker-selenium)** infrastructures
- Less maintenance work with standalone Firefox server to get Docker images 
- On-demand **[Docker containers](https://github.com/SeleniumHQ/docker-selenium)** spin-ups without setting up virtual machines

## **Loving Selenium? Give Katalon Studio a Try Too!**

![Try Katalon](https://d1h3p5fzmizjvp.cloudfront.net/wp-content/uploads/2021/11/Try-Katalon-Selenium-alternative.png)

As a legacy library, many **[test automation tools](https://www.katalon.com/resources-center/blog/automation-testing-tools/)** have used Selenium as a base to develop a complete framework that is ready to use 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](https://www.katalon.com/mobile-testing/)** (iOS, Android)

[![Download Katalon Studio](https://d1h3p5fzmizjvp.cloudfront.net/wp-content/uploads/2021/11/Button-_Download-Katalon-Studio1.png)](https://www.katalon.com/katalon-studio/?utm_source=katalon&utm_medium=blog&utm_campaign=sel_4_blog)

The post [The Release of Selenium 4 (and 4.1) | Top Features to Look Into](https://www.katalon.com/resources-center/blog/selenium-4-features/) appeared first on [Katalon Solution](https://www.katalon.com).