Architecture of Selenium

Selenium works in client-server architecture.

Selenium has 4 main components:

  • Developers of Selenium have developed these libraries corresponding to different languages
  • To interact between client and server as shown above, we have JSON Wire Protocol. JSON Wire Protocol is a component that converts the request in such a way that is understood by the server and vice versa
  • Drivers interact with real browsers. We want drivers as a middleware component from selenium because browsers do not want to expose their functionality/implementation to the third party
  • And at the end we have real browsers

So as to understand the architecture of Selenium. Let’s consider a piece of code.

WebDriver driver = new ChromeDriver();
driver.get("https://google.com");
  • The above request is sent to JSON Wire Protocol. We also have selenium APIs which do some conversion and send to JSON Wire Protocol.
  • Now JSON Wire Protocol has REST APIs which work over HTTP.
    For every command in selenium there is a corresponding API in JSON Wire Protocol
  • The above REST API has a JSON format, and this goes as a URL to browser Drivers.
    Every browser driver has its own HTTP server
  • Based on the information received by the drivers, drivers will interact with the real browsers
  • Response is sent back from real browser back to console/language bindings.

About the author

Deepak Sood

Deepak Sood is Lead Consultant in an IT firm holding expertise in Devops and QA Architecture with 8 years of experience.

His expertise is in building highly scalable frameworks. His skills include Java, Configuration Management, Containers, and Kubernetes.

Reach out to him using contact form.

View all posts