Selenium WebDriver Architecture
Selenium Webdriver architecture will discuss about how the selenium webdriver will work. It is very important and mandatory that we should know the architecture of the tool which we are going to use. So, in this blog we will discuss about the selenium webdriver architecture.
Below is the diagram for the selenium architecture:
In the above diagram we can see these sections:
- Language Bindings
- Webdriver API
- Webdriver SPI
- JSON Wire Protocol
- Browsers Drivers
Language Bindings:
Here we can see that so many language bindings, which are used to implements/develop the selenium webdriver code. Using this code these will interact with the Webdriver. All the language bindings will have same kind of API, so, we have common set of commands to work with.
Webdriver API:
By using language binding commands webdriver will translate to the SPI, which is stateless.
Webdriver SPI:
When code enters the Stateless Programming Interface or SPI, it is then called to a mechanism that breaks down what the element is, by using a unique ID, and then calling a command that is relevant. All of the API calls above then call down.
From there we call the JSON Wire protocol. We still use HTTP as the main transport mechanism. We communicate to the browsers and have a simple client server transport architecture the WebDriver developers created the JSON Wire Protocol.
JSON Wire Protocol:
The WebDriver developers created a transport mechanism called the JSON Wire Protocol. This protocol is able to transport all the necessary elements to the code that controls it. It uses a REST like API as the way to communicate.
Browser Drivers:
Here we can see so many browsers like Firefox Browser, Chrome Browser, Opera Browser and IE Browser etc. Each browser will contain separate driver. When it received the command from the webdriver it will execute the command on the respective browser and it will give the response back in the form of HTTP Response.
Points to Remember:
- For each language binding command, one HTTP request is created and send it to the browser driver.
- The Webdriver API translates to SPI
- It is then called to a mechanism that breaks down what the element is, by using a unique ID, and then calling a command that is relevant.
- JSON wire protocol is able to transport all the necessary elements to the code that controls it.
- When it received the command from the webdriver it will execute the command on the respective browser and it will give the response back in the form of HTTP Response.
Please watch the YouTube video for this blog for better understanding.