How Selenium WebDriver Works

In this blog, we will discuss how Selenium Webdriver tool works.

Before going into working in short we can see what selenium is

  •     Selenium is an open-source tool that automates web browsers.
  •     Selenium was founded by Jason Huggins

Working of selenium webdriver

Working of selenium webdriver

  1. Selenium works on client-server architecture
  2. We need to make use of selenium client libraries to write automation scripts. When we write the script in IDE(selenium client libraries Plus your automation script), The script is sent to the JSON Wire Protocol via an API.
  3. JSON Wire Protocol acts as a connector between client and server. JSON Wire Protocol has a REST API that accepts JSON format and aims to send requests to Browser Driver via HTTP.
  4. Each browser driver has an HTTP server that accepts requests from clients sent by JSON Wire Protocol
  5. Browser Driver is used to interact with the real browser and deliver automation script instructions to the real browser to be turned into action.
  6. When the actions are performed in real browser, the corresponding response will be sent to the console via browser driver to JSON Wire Protocol and then to the console of the client.

But in Selenium Webdriver 4 version, the JSON Wire Protocol is deprecated.

The working will be changed as below.

Working of Selenium Webdriver 4

Selenium 4 uses W3C standard Protocol because of which driver and the browser communication follows the standard procedure.

This does not require encoding and decoding of the API which was followed in selenium 3 which used JSON Wire protocol.

The communication happens directly between Webdriver and Browser.

Advantages of Selenium 4 using W3C standard protocol.

  • The tests will be more consistent across the browsers.
  • The standard protocol will ensure that the tests are stable.
  • We can make use of relative locators for locating a webelement.
  • Provides native support for Chrome DevTools Protocol which helps us to use chrome develepment tools properties like network, profiler, application cache, etc.

Summary

Hope you understand how selenium webdriver works by going through this blog.

Thanks Happy learning...........