Selenium 4 is the newest release of a popular open-source automation testing tool. Jason Huggins invented Selenium in 2004. Teams write Selenium scripts in many programming languages, like Python, Java and C#. The current version is Selenium 4.3, which arrived in 2022.
Many browsers run Selenium tests, including Google Chrome, Mozilla Firefox, Internet Explorer and Safari. Windows, Mac and Linux can all run the scripts too. WebDriver is the web framework that executes the script and performs the tests. Every browser has its own driver for this job.
One important thing to note is that Selenium only automates web applications. It cannot automate desktop applications. Selenium saves time, and the results are accurate. With WebDriver, we can also generate reports in a proper format.
What Are the New Features in Selenium 4?
Network interception is one of the new features. Selenium 4 can also authenticate a website with basic or digest authentication.
Network interception
Network interception means capturing network traffic to see what is happening on the network. With Selenium 4, we can get HTTP status codes and change HTTP traffic.
Basic and digest authentication
Basic authentication is an HTTP method where a client sends a request to the server with a username and password. Digest authentication is more secure than basic authentication. The client does not send the username and password. Instead, it creates a hash with an algorithm.
Selenium IDE
The Selenium IDE records the actions you take on your website and then plays the same actions back. Before Selenium 4, the extension only worked in Firefox. Now both Firefox and Chrome can record and play user actions.
The new Selenium IDE adds backup element selectors, control flows and command line runners, also known as CLI runners. In addition, the Selenium IDE is now available as an Electron app. The Electron app lets you listen to events from your browser through the debug log.
Selenium Grid
Selenium Grid lets you run test scripts remotely on virtual or real machines. It forwards commands from the client to the remote browser instance. As a result, you can run test scripts in parallel on many computers, browsers and operating systems.
Selenium 4 brings a new grid with an advanced architecture. Its components include clients, routers, session queues, dispatchers, session mappers, nodes and event buses. In addition, GraphQL is a new way to query and retrieve data.
Why Selenium 4 Uses the W3C WebDriver Protocol
According to Simon Stewart, creator of Selenium WebDriver, the main reason to upgrade to Selenium 4 is the W3C WebDriver protocol. It has at least three benefits. First, it provides a standard. Second, it guarantees stability. Third, it gives you an updated Actions API with better resources.
The Selenium 3 architecture used the JSON wire protocol. Its goal was to transfer information from the client to the server. The tool sent an HTTP request and received an HTTP response to do this.
The main change inside WebDriver is full W3C compliance with the Selenium WebDriver API. This standard removes the need to encode and decode API requests, which Selenium 3 and earlier versions did through the JSON wire protocol. This means WebDriver now talks directly to the target browser.
This standard also makes cross-browser testing more robust. Common browser drivers like Chrome Driver and Gecko Driver fully adopt the W3C protocol, so the change will not affect existing users.
Chrome and Edge developer tools
Selenium 4 has many methods in a class called the ChromiumDriver class. You can control the Chrome and Edge developer tools in two ways. These two methods are executeCdpCommand() and getDevTools().
You can use executeCdpCommand to run a Chrome DevTools Protocol command directly by passing parameters to it. The getDevTools method returns DevTools.
Why Teams Choose Selenium 4 for Web Testing
Selenium is an affordable and adaptable solution that lets web application developers automate testing. The most exciting feature is the ability to test programs in many web browsers. This prevents a website from crashing or breaking in certain browsers.
Selenium is ideal for companies that build high-traffic applications, like social platforms and e-commerce websites. It has improved over time and has added value to web development.
Selenium is the most successful test automation tool for QA because of its many qualities. It is open source, supports many languages, integrates readily with many platforms and suits online applications best. As a result, companies should consider Selenium a viable test automation tool for web application testing. A next-generation testing services provider can use automated Selenium testing to reach faster time to market, higher ROI and flawless apps. You can read more on the official Selenium site, or browse more Zehntech articles.
Have a question about this?
Book a 30-minute call with an engineer who works on it.



