What is the Selenium Web Driver Architecture?

Software TestingAutomation TestingSelenium Web Driver

Selenium Web Driver architecture in a simplified diagram is described below:

Let us now understand the Selenium Web Driver Architecture. Selenium WebDriver API enables interaction between browsers and browser drivers. This architecture consists of four layers namely the Selenium Client Library, JSON Wire Protocol, Browser Drivers and Browsers.

  • Selenium Client Library consists of languages like Java, Ruby, Python, C# and so on. After the test cases are triggered, entire Selenium code will be converted to Json format.

  • JSON stands for Javascript Object Notation. It takes up the task of transferring information from the server to the client. JSON Wire Protocol is primarily responsible for transfer of data between HTTP servers. Generated Json is made available to browser drivers through http Protocol.

  • Each browser has a specific browser driver. Browser drivers interact with its respective browsers and execute the commands by interpreting Json which they received from the browser. As soon as the browser driver gets any instructions, they run them on the browser. Then the response is given back in the form of HTTP response.

Let’s consider the following block of code −

WebDriver driver = new ChromeDriver();
driver.get (“https://www.tutorialspoint.com/index.htm“);

Once we run this 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 fed 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.

Now if the request is that of POST, it will trigger an action on the browser. If it’s a GET request, then the response will be produced at the browser end. Finally it will be passed over HTTP to the browser driver. The browser driver will in turn send it to the UI via JSON Wire Protocol.

This sums up the overall explanation of the Selenium WebDriver Architecture.

raja
Published on 10-Jun-2020 15:21:46
Advertisements