Site icon TestingDocs.com

Selenium WebDriver Architecture

Introduction

Let us get an overview of Selenium WebDriver architecture. The architecture of Selenium WebDriver is simple and easy to understand.

Selenium WebDriver is an API for web automation that is easy and makes our tests easier to develop and maintain. It is an Object-oriented API that provides good support for Web Application Automation and Testing.WebDriver is not attached to any tool. So, integration with other frameworks is easy.

WebDriver Architecture

Language bindings are a wrapper exposed to us to write code against. Also, this allows Webdriver API to support multiple languages and browsers, as shown in the below figure. The example program Languages are Java, C#, Python, Javascript, etc. Furthermore, by using language bindings, we can invoke the browser-specific implementation of WebDriver to interact with the web application.

 

 

For example, the easiest way to download Java bindings is by using the Maven build tool. Maven will download the Java bindings and all its dependencies and create the project using a pom.xml file.

Under the hood: JSON wire protocol

Commands issued in the code would be converted to Restful Web service request/response with JSON payload ( application/JSON). In addition, JSON is a popular data format with libraries for handling it available for almost every language. Also, browsers can transform a string into an object using a straight call with primitives designed to transform a Javascript object to and from a string securely and without side effects. Furthermore, browser driver applications will natively communicate with different Web browsers to issue commands against Web Applications under Test.

 

 

 

For example, a call to the driver.get(“https://www.bing.com”); would be mapped to a POST request to a URL encoding the session ID and ending with “/URL”, with the parameters.

POST on  URL    ( /session/<sessionId>/url )

{ “url”: “https://www.bing.com” }

Selenium Tutorials

Selenium WebDriver Tutorials on this website can be found at:

https://www.testingdocs.com/selenium-webdriver-tutorial

For more details on the Selenium, visit the official website at:

https://www.selenium.dev/

Exit mobile version