Selenium Architecture

Priyanka - Jun 11 - - Dev Community

Describe python selenium architecture in details?
Selenium is an open-source framework for automating web browsers.
Architecture of selenium is designed to be modular and flexible, allowing users to choose the components that best suit their needs.
1.Selenium IDE
Image description**

IDE stands for integrated development environment.
User needs to download and install the extension for that web browser.
It can automate as well as record the entire automation process.
2.Selenium RC
Image description**

Selenium RC comprises of two parts.
Client libraries for preferred computer language
A server that launches and kills browser automatically.
This is older version of selenium that is not used much anymore.
3.Selenium web driver

Image description

It is a major component of selenium test suite.
It provides interface between programming language in which we write our script and web browser itself. It provides a seamless programming interface that allows effective communication and control over web browsers.
It is composed of various components that work together.
Selenium Client Library
It consists of language bindings or command utilized for crafting automation scripts.
These commands are compatible with TCP\IP and HTTP protocols.
They utilize wrappers to transmit the script commands to web browser for test execution.

Selenium API
It is a set of rules and regulations which your python program used to communicate with each other.
It helps in automation without need of user to understand what is happening in background.

Json wire protocol
Commands user writes get converted into JSON (java Script Object notation) which is t hen transmitted across the network or to you web browser so that it can be executed or automation and testing. Json requests send to client using TCP-IP\HTTP protocol.

Browser drivers
Selenium web drivers communicates directly with the web browsers, controlling actions. This allows you to automate tasks on the web browser without any manual intervention.

4.Selenium Grid

Image description

It is used to run parallel tests on multiple devices running on different browsers at different geographical locations.
It works on Master-slave architecture.

What is the significance of the python virtual environment? give some examples in support of your answer?
Python Virtual environment is an isolated space where you can work on your python project, separately from your system installed python.
You can setup you ow libraries and dependencies without affecting the system python.
Consider you are working on a two web bases projects one of them uses Django 4.0 and other one is using Django 4.1. in such situations, we need to create a virtual environment in python that can be useful to maintain dependencies of both projects.

We use a module named virtual which is a tool to create virtual environments in python, isolated from system environment python.

Install Virtual python environment.
pip install virtualenv

Test your installation:
virtualenv - - version

create a new virtual environment for your project.
virtualenv
To activate virtual environment, go inside project folder.
Cd
Scripts
Once environment get activated the name of virtual environment will appear on the left side of the terminal.
Then you can install your dependencies are per current project
Pip install Django==1.9

Once you are done with work of current project, then you can deactivate your virtual environment.
Scripts

Example of Python Virtual environment

Image description
Here in diagram, we have shown as 3 virtual environments and each environment have different python version and different 3rd party libraries.

. . . . . . .