How does the Selenium WebDriver work?

The working of Selenium webdriver is described in the below image −

Source Img :−is−web−driver−in−selenium

Selenium webdriver contains the below components −

  • Selenium Binding Languages − Selenium can work on more than one language like Java, Python, C#, Ruby, and so on as it has the bindings for all these languages.

  • JSON Wire Protocol − JavaScript Object Notation is called the JSON Wire Protocol. It dispatches data from the server to the page of the client. It is developed on REST API which carries information inside the HTTP servers.

  • Browser Driver − Every browser has a driver with which it establishes communication. As a web driver receives a command, it is run on the browser and the execution result is forwarded in format of HTTP response.

  • Browser − Selenium supports more than one browser like Chrome, Firefox, IE, Safari, and so on.

As we trigger the tests, the test scripts developed are converted to an URL via the JSON Wire Protocol using the HTTP. The URL will then be used by the browser driver which receives it in form of HTTP request with the help of HTTP server.

Then the browser driver forwards the request to the browser through HTTP and the implementation code gets executed. If there is a POST request, an action will be performed on the browser.

If there is a GET request, a response is obtained by the browser. It shall then be passed to the driver via the HTTP protocol. Finally, the browser forwards it to the IDE used with the help of the JSON Wire Protocol.

Selenium webdriver usages are in the following areas −

  • Mobile Testing.

  • Regression Testing.

  • Smoke Testing.

  • Functional Testing.

Besides, it can be used to monitor the status of an application along with the events or errors happening on it.