DEV Community

VidyaShaliniM
VidyaShaliniM

Posted on

Python Selenium Architecture

Selenium is an open source automated testing framework used to validate web applications and performing browser automation which works on all major Operating Systems and can be written in any many programming languages like Python, Java, C# etc.

Selenium with Python is widely used due to the following reasons:

  • Selenium is open source and portable testing framework
  • Selenium is a combination of tools and Domain Specific Language in order to carry out various tests.
  • Selenium commands are divided in terms of different classes which makes it easy to understand and implement.
  • The amount of time required to do testing repeated test scenarios on each and every new build is reduced to zero.
  • Python is dynamically typed, object oriented and functional programming and can serve as scripting language for web applications which makes it very convenient to work with Selenium.

Python Selenium Architecture:
Selenium WebDriver Architecture is made up of four major components:

Selenium Client library: Selenium supports multiple libraries such as Ruby, Python, Java, etc as language bindings

JSON wire protocol over HTTP: JSON full form is JavaScript Object Notation. It is an open standard that provides a transport mechanism for transferring data between client and server on web.

Browser Drivers: Selenium browser drivers are native to each browser, interacting with the browser by establishing a secure connection. Selenium supports different browser drivers such as ChromeDriver, GeckoDriver, Microsoft Edge WebDriver, SafariDriver, and InternetExplorerDriver.

Browsers: Selenium provides support for multiple browsers like Chrome, Firefox, Safari, Internet Explorer etc

               In Selenium 3, there is no direct communication between the client libraries (Java, Python, JavaScript, etc) and the browser drivers. The server (browser drivers) does not understand language but only the protocols and on the other hand, client libraries does not understand protocols used by browser drivers. 
Enter fullscreen mode Exit fullscreen mode

Therefore, JSON Wire protocol is being used as a mediator between client and server to encode and decode the requests and responses made by client and server respectively. This results in limited browser interaction, inefficient communication and lack of standardization.
So, Selenium 4 WebDriver was made W3C compliant to make the communication easy and direct between the client libraries and the browser drivers. Improved communication led to more stability.

Top comments (0)