Protected by Copyscape
Powered By Blogger

Tuesday, April 6, 2021

How Selenium Web Driver API works internally?

Here in this post, I am going to explain the Selenium Web Driver Architecture which is a very basis question during interviews now a days.

Selenium WebDriver is an API which supports many languages like Java, C#, Python etc. 

API (Application Programming Interface) works as an interface between various software components. Selenium WebDriver API helps in communication between languages and browsers.

Below is the framework architecture diagram of  Selenium Web Driver.


Major four components we have in the above diagram.

  • Selenium Client Library
  • JSON Wire Protocol
  • Browser Executable Drivers
  • Browsers
Selenium client library consist of multiple languages like Java, C#, Python, Ruby etc. Once the test cases are triggered the code written in Java or in any other supported language it gets converted into  JSON format.

JSON stands for Java Script Object Notation which is responsible for transferring the JSON code to the Browser Driver using HTTP Protocol. JSON Wire Protocol is responsible for transfer of data between HTTP servers

Each Browser has a dedicated browser driver. Browser driver interacts with its respective browser and execute the commands by interpreting JSON which they receive from the Browser. When Browser driver gets any instruction they run them on the Browser and response is given back in the form of HTTP Response.


Take an example of the below code

WebDriver driver=new ChromeDriver();

driver.get("http://www.google.co.in");

When we run the above block of code, the entire code will be converted with the help of JSON Wire Protocol over HTTP as a URL. The converted URL will be given to the ChromeDriver.

The browser driver utilizes HTTP server to get the request from HTTP. As the browser driver gets the URL, it passes the request to its browser via HTTP. It will trigger the event of executing the Selenium instructions on the browser.


I will keep adding more automation concepts in my upcoming posts. Please keep me posted if you have any questions and concerns.



Best of Luck.

No comments: