TOPIC - ARCHITECTURE OF SELENIUM AND PYTHON VIRTUAL ENVIRONMENT

syedalia21

Syed Ali

Posted on October 16, 2024

TOPIC - ARCHITECTURE OF SELENIUM AND PYTHON VIRTUAL ENVIRONMENT

ARCHITECTURE OF SELENIUM

Image description

Selenium IDE

Shinya Kasatani of Japan created IDE (Integrated Development Environment), Its web browser extension that can automate the browser through record and playback feature. It is not make test reposts and It is the simplest framework in the Selenium suite and the easiest one to learn.

Selenium Remote Control( RC )

  1. Paul Hammant came up with the concept of Selenium RC to overcome the problems of Selenium Core.
  2. This system is known as Selenium RC or Selenium 1. Selenium RC was the testing framework of the whole Selenium project for a long time.
  3. This was the first tool that allowed users to use a programming language they preferred like Java, Python, Ruby, etc.
  4. However after the introduction of WebDriver in the Selenium 2 version, people started using WebDriver,
  5. RC is deprecated from Selenium 3 onwards. Selenium 4 is the latest release

Selenium WebDriver

WebDriver is also an API. API contains many classes and methods by which we can communicate with the client and server. WD acts as a mediator between browser and client libraries.

WebDriver is one of the components in Selenium by which we can automate the browser. WebDriver has different commands by which we can interact with the elements on the Webpage and we can perform different types of actions(Clicking buttons, entering texts, navigating pages) on the web applications.

Simon Stewart created WebDriver in 2006.

Selenium WebDriver is a robust tool for automating web browsers. Its architecture consists of several key components:

Selenium Client Library

  1. The Client Library provides language-specific bindings (like Java, Python, C#, etc.) that enable developers to write Selenium scripts.
  2. These commands are compatible with HTTP, TCP-IP protocols

Selenium API

  1. Acting as a mediator, the WebDriver API translates commands from Selenium scripts into a format that browser-specific drivers can understand. It defines a set of interfaces and methods for interacting with browsers.

JSON Wire Protocol

  1. The commands that you write gets converted into JSON which is then transmitted to the network or to your web browser so that it can be executed for automation or testing
  2. The JSON requests are sent to the client using TCP-IP/HTTP protocols.

Browser Driver

  1. It acts as a bridge between the Selenium scripts and web browser.
  2. It helps us to run the Selenium test-scripts, which comprises the commands written in a particular programming language to be executed on the web browser.

Selenium Grid

It is a tool that runs parallel tests across different machines and browsers.
Image description

What is the significance of the Python Virtual Environment? Give some examples in support of your answer ?

When developing software with Python, a basic approach is to install Python on your machine, install all your required libraries via the terminal, write all your code in a single .py file or notebook, and run your Python program in the terminal.

This is a common approach for a lot of beginners and many people transitioning from working with Python for data analytics.

This works fine for simple Python scripting projects. But in complex software development projects, like building a Python library, an API, or software development kit, often you will be working with multiple files, multiple packages, and dependencies. As a result, you will need to isolate your Python development environment for that particular project.

Benefits:

  • You can have multiple environments, with multiple sets of packages, without conflicts among them. This way, different projects’ requirements can be satisfied at the same time.
  • You can easily release your project with its own dependent modules.

Setting Up a Virtual Environment

Here's a quick guide on how to set up and use a virtual environment:

Install Python Virtual Environment

Pip install virtualenv

Verify Python Virtual Environment

Virtualenv --version

Create Virtual Environment ( To create project folder )

virtualenv <name_of_project>
cd <name_of_project>

Activate Virtual Environment

Scripts\activate

Deactivate Virtual Environment

Scripts\deactivate

Install Python Selenium Module

pip install selenium

Install Python WebDriver Manager Module

pip install webdriver-manager

Conclusion

The use of Python Virtual Environments is essential for managing project dependencies effectively and ensuring that different projects can coexist peacefully on the same system.

💖 💪 🙅 🚩
syedalia21
Syed Ali

Posted on October 16, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related