Task 18:1.Describe Python Selenium architecture in detail 2. What is the significance of Python virtual Environment
Tags: beginners, python, selenium, automation
Published: 2023-12-13 18:00:20

1. Architecture of Selenium WebDriver(Selenium 3)

Selenium WebDriver Architecture is made up of four major components: 
1. Selenium Client library: Selenium supports multiple libraries such as Ruby, Python, Java, etc as language bindings.
 
2.JSON wire protocol over HTTP: JSON is an acronym for JavaScript Object Notation. It is an open standard that provides a transport mechanism for transferring data between client and server on the web.

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

4. Browsers: Selenium supports multiple browsers like Chrome, Firefox, Safari, Internet Explorer, etc.

The architecture of Selenium WebDriver (Selenium 3)

It is an open standard that provides a transport mechanism for transferring data between client and server on the web. 
Browser Drivers: Selenium browser drivers are native to each browser, interacting with the browser by establishing a secure connection

selenium client----->JSON wire --->Browser------->     Real
Libraries            Protocol      drivers          Browsers
(Python, C#, Java)                (Chrome Driver,      (Chrome,
                                Firefox Driver,       firefox)                    
                                InternetExplorer,      
                                Microsoft Edge driver)  

In Selenium 3, the client libraries (Java, Python, JavaScript, etc.) do not directly communicate with the browser drivers. The browser drivers only understand the protocols and not the language used by the client libraries. Similarly, the client libraries do not understand the protocols used by the browser drivers. 

JSON Wire protocol is a mediator between client and server to encode and decode requests and responses.
................................................................
The architecture of Selenium 4 WebDriver:

The architecture of Selenium 4 is similar to Selenium 3, however, it uses W3C protocol instead of JSON wire protocol for communication between Client Libraries and Browser Drivers.

Selenium client 
libraries      --->      W3C protocol-->Browser---> Real 
(Python, Ruby, java, etc)                Drivers    Browsers

W3C stands for World Wide Web Consortium.
It develops and maintains standards and guidelines for the World Wide Web.
It creates open standards and specifications that promote compatibility and consistency across various web technologies and platforms.
Selenium 4 WebDriver now complies with W3C standards for improved communication between client libraries and browser drivers, leading to greater stability.
..................................................................2.Significance of Python virtual environment

The Python virtual environment is an important tool for maintaining project-specific environments. It helps prevent dependency issues, improves version compatibility, and aids in managing, sharing, testing, and deploying Python projects. Here are some of the main reasons why Python virtual environments are essential:

1. Dependency isolation: 
      In case a user has multiple projects, each project may require different dependencies. Creating separate virtual environments ensures that each project can work independently without any clashes.

2. Version Compatibility: 
     The virtual environment ensures correct project execution by using specific library and package versions.

3. Project Portability: 
     A virtual environment allows users to easily transfer their projects from one machine to another. This is particularly useful when multiple people are working on the same project and need to work on it independently on their own machines. By sharing the code along with all necessary dependencies and requirements, everyone can work on the project seamlessly.

4. Easy testing and deployment: 
     It ensures that a project uses a well-defined set of dependencies, making testing and deployment easier.