Task-18 RoadMap-18
Published: 2024-05-06 11:30:41

_**Python Selenium Architecture in Detail**_

**Selenium** is used as an Application Programming Interface [API] to automate the test cases of web applications.

Selenium is used as an automation tool for web application testing, using Python programming language. Selenium scripts can be written using only programming languages; the most commonly used programming languages are Java and Python.

Python and Selenium work together to create automation scripts and code that are used to interact with web browsers.

Selenium Suite comprises Selenium IDE, Selenium RC, Selenium Webdriver, and Selenium Grid.

**Selenium Webdriver Architecture**
Selenium WebDriver architecture is designed to support cross-browser testing and parallel testing. It also supports integration with testing frameworks to improve automation testing and reporting.

Selenium WebDriver Architecture is made up of four major components:

1. Selenium Client library: (Selenium language Binding)

a.	Selenium supports multiple libraries such as Ruby, Python, and Java as language bindings.
b.	Selenium commands in the desired programming language in compliance with the W3C Selenium protocol.
c.	The selenium client library can be divided into two groups:
i.	Web Driver protocol clients - They are thin wrappers around WebDriver protocol HTTP calls.
ii.	WebDriver-based tools - These are higher-level libraries that allow us to work with WebDriver automation.
d.	Selenium API:
i.	Selenium API is a set of rules and regulations that the programs use to communicate with each other.
ii.	APIs work as an interface between the program and aid in their interaction without any user knowledge.

2. JSON wire protocol over HTTP:

a.	JSON is an acronym for JavaScript Object Notation
b.	The Selenium WebDriver uses JSON to communicate between client libraries and drivers.
c.	The JSON requests sent by the client are converted into HTTP requests for the server’s understanding and again converted back to JSON format while sending it to the client again.
d.	This data transfer process is serialization.
e.	By this method, the internal logic of the browser is not revealed, and the server can communicate with the client libraries, even if it is not aware of any programming language.

3)	Browser Drivers

a.	Browser drivers act as a bridge between the Selenium libraries and the browsers. 
b.	They help to run Selenium commands on the browser.

4)	Browsers
a.	Selenium test scripts can be run across various browsers like Chrome, Safari, Firefox, Opera, and Internet Explorer and operating systems like Windows, Mac OS, Linux, and Solaris.

**> Significance of the Python Virtual Environment with Examples**

_Python virtual environments_ are the light version of the conda environments. 

Virtual environments are a native tool to Python developers, and they provide functionality similar to that of the conda environments. 
The main difference is that they rely on the Python package manager.

A virtual environment is created on top of an existing Python installation, known as the virtual environment's “base” Python, and may optionally be isolated from the packages in the base environment, so only those explicitly installed in the virtual environment are available.

It contains a specific Python interpreter and software libraries and binaries that are needed to support a project (library or application) Isolated from software in other virtual environments and Python interpreters and libraries installed in the operating system.

Contained in a directory, conventionally either named venv or .venv in the project directory, or under a container directory for lots of virtual environments, such as ~/.virtualenvs.

It does not check into source control systems such as Git.

Considered as disposable – it is simple to delete and recreate it from scratch. project code not required in the environment

Not considered as movable or copyable – it is re creatable in the same environment in the target location.

Email, chat, and web-based document-sharing applications are all examples of virtual environments. Simply put, it is a networked common operating space.