Selenium Architecture.
Selenium WebDriver API enables interaction between browsers and browser drivers.
This architecture consists of four layers namely:
a. Selenium Client Library,
b. JSON Wire Protocol,
c. Browser Drivers
d. Browsers.
The below figure explains the interaction between:
Selenium Client & WebDriver language bindings:
Selenium supports libraries for Java, JavaScript, C#, Ruby, and Python.
So when you type
System.setProperty(“webdriver.chrome.driver”,“/path/to/chromedriver”);
WebDriver driver = new ChromeDriver();
driver.get(“http://www.google.com/");
Selenium creates a JSON(Javascript Object Notation) payload. JSON Wire Protocol is primarily responsible for transfer of data between HTTP servers. Based on the capabilities provided, the request will be sent in the form of JSON wire protocol over HTTP to browser drivers and then to the real browsers.
Each browser has a specific browser driver. Browser drivers interact with its respective browsers and execute the commands by interpreting Json which they received. 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. Then the response is given back in the form of HTTP response.
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.
For successful request it will return 200, In case of failure it will return 500, different response codes will be returned. On the editor response will be interpreted accordingly, say 500 — Element not found exception.