Selenium WebDriver: Selenium WebDriver Architecture

There are four components of Selenium Architecture:

Selenium Client Library
JSON Wire Protocol over HTTP
Browser Drivers

Selenium Client Library:

Selenium supports multiple libraries such as Java, Ruby, Python, etc., Selenium Developers have developed language bindings to allow Selenium to support multiple languages.
Below is the link to download Selenium Client Language Bindings:

JSON Wire Protocol over HTTP:

JSON stands for JavaScript Object Notation. It is used to transfer data between a server and a client on the web. JSON Wire Protocol is a REST API that transfers the information between HTTP server. Each BrowserDriver (such as FirefoxDriver, ChromeDriver etc.,)  has its own HTTP server.

Browser Drivers:

Each browser contains separate browser driver. Browser drivers communicate with respective browser without revealing the internal logic of browser’s functionality. When a browser driver is  received any command then that command will be executed on the respective browser and the response will go back in the form of HTTP response.

Real Browsers:

Selenium supports multipe browsers such as Firefox, Chrome, IE, Safari etc.

How Selenium Works Internally:

Lets say you have written below couple of lines of code:

WebDriver driver  = new ChromeDriver();

Based on the above statements, Chrome browser will be launched and it will navigates to automationtestinginsider website.

Once you Run the program, every statement in your script will be converted as a URL with the help of JSON Wire Protocol over HTTP. The URL’s will be passed to the Browser Drivers. (In this case, ChromeDriver). Here in our case the client library (java) will convert the statements of the script to JSON format and communicates with the ChromeDriver. URL looks as shown below.


Every Browser Driver uses a HTTP server to receive HTTP requests.  Once the URL reaches the Browser Driver, then the Browser Driver will pass that request to the real browser over HTTP. Then the commands in your selenium script will be executed on the browser.

If the request is POST request then there will be an action on browser

If the request is a GET request then the corresponding response will be generated at the browser end and it will be sent over HTTP to the browser driver and the Browser Driver over JSON Wire Protocol and sends it to the UI (Eclipse IDE).

This is how Selenium Commands works internally.

To get more details please watch below youtube video and Subscribe the channel.

No comments:

Post a Comment