selenium 3 vs selenium 4

In this article, We will see the difference between Selenium 3 vs Selenium 4, the Architecture of Selenium 3 and Selenium 4, and the Advantages of Selenium 4.

Selenium is widely used nowadays in the industry and extensively used framework for UI automated testing. Selenium has marked its appearance in the automation testing industry due to its open-source nature and innumerable features that make the testing process faster when compared to other tools.

Selenium 3 Architecture

Selenium 3 architecture supports JSON Wire Protocol, here JSON stands for JavaScript Object Notation. Selenium 4 does not include the JSON Wire Protocol and that’s the main difference between selenium 4 and Selenium 3.

JSON Wire Protocol transfers the information from the client to the server over HTTP, here HTTP stands for Hypertext Transfer Protocol, in this, a selenium request is sent from a selenium client, the request is received by the JSON Wire Protocol over HTTP, and secured by the browser Driver, after that a response returned by the server and received by the client.

Below the diagram is a graphical representation of Selenium 3 Architecture:

Selenium 3 Architecture

Selenium 4 Architecture

In Selenium 4 there is direct communication between the client and server. In selenium 4 client has 2 parts first is Selenium Client & the other one is WebDriver Language Bindings while Browser Drivers are the server.

In selenium 4, Selenium Client sends out a request to perform a command. The WebDriver Language Bindings is a code library that is mainly designed to drive actions. Browser Drivers receive the request sent by the client and then return a response after an automation Test Script executes on the Web Browser.

The Selenium Client and WebDriver Language Bindings are an important part of the architecture where each language has its own unique bindings. Bindings mean that the same commands can be used by different languages. for example, a command written in java language has also been written in other languages like c#, Python, Ruby, etc.

When we talk about the Browser Drivers and Web Browsers, WebDriver drives each and every browser using the browser’s built-in automation support. A Browser Driver such as Chrome Driver controls the Chrome browser.

Selenium 4 is different from Selenium 3, As In Selenium 4 ChromeDriver and EdgeDriver extend ChromiumDriver while RemoteWebDriver is the parent to ChromiumDriver.

Selenium Architecture direct

Selenium 4 Advantages

There are the following advantages of Selenium 4 over Selenium 3:

1) Usage Of WebDriver Manager: Selenium 4 has come with the biggest advantage with the use of WebDriver Manager, In the selenium 4 release there is no need to download the latest executable for an individual browser, we can write a single line code that can download the latest version for the specified driver.

WebDriverManager.chromedriver.setup();

2) Relative or Friendly Locator: There are different locators available to locate the Web Element on the web, in addition, selenium 4 has come up with new relative locators below are some:

  • toLeftOf(): Find the element to the left of a specified element.
  • toRightOf(): Find the element to the right of the specified element.
  • above(): Find the element above with respect to the specified element.
  • below(): Find the element below with respect to the specified element.
  • near(): Find the element is at most 50 pixels far away from the specified element. The pixel value can be modified.

3) Capture screenshots of a specific Web Element: In selenium 3 we can capture screenshots of the entire page but with the help of selenium 4, we can capture screenshots of a specific web element.
4) Stability: With the help of Selenium 4 we can achieve stability.

Selenium 3 Vs Selenium 4

In Selenium 3, the chrome driver class directly extends to the Remote Web Driver. But In Selenium 4 Chrome driver class extends to Chromium Driver, which has some predefined methods to access the dev tool. In Selenium 3, JSON Wire Protocol plays an important role in communication, and its the major mode of communication between the test code and the browser.

Conclusion:

Selenium 3 and Selenium 4 are different from each other in their own way, selenium 4 comes up with different and beautiful features by Using a web driver where there is no need to download the executable you can just use WebDriverManger class to set up the driver, also there is different relative locator available in selenium 4 by using that you can find the web element on a webpage.

Read Also:

1) 11 Best Selenium Alternatives for Testers

2) Benefits of Selenium Webdriver for Automation Testing

3) Selenium Vs Protractor – What’s the Difference?

Deepali Chadokar

Deepali works as a Software Development Engineer in Test, at QACraft, she is a computer science engineer with a degree of bachelor and has 3+Years of experience in the software industry as a Manual Tester and Automation Test Engineer. In her free time, she loves reading and podcasts.

https://qacraft.com/author/deepali-chadokar/