DEV Community

Bhavani K
Bhavani K

Posted on

PYTHON SELENIUM ARCHITECTURE

Selenium is the open-source framework, helps to automating web browsers. Python Selenium architecture consists of several components that work together to enable the automation of web browser interactions. It is designed to be modular and flexible, allowing users to choose the components suit their needs. It uses combination of python and selenium
in a effective way that provides greater facility to automate web browser interactions.

  • Selenium WebDriver API
  • Selenium Client Libraries/Python script
  • Browser Drivers
  • JSON Wire Protocol
  • Web Browsers

1. Selenium WebDriver API:
Web driver is a collection of API's (Application Programming Interface) works as an interface between various software components.Selenium Webdriver API helps in communication between languages and browsers, it helps to control actions in browser. Selenium supports many programming
languages such as Java, C#, Python..., and also it supports multiple browsers such as Google Chrome, Firefox, Internet Explorer ...,

2. Selenium Client Libraries/Python script:
Selenium supports multiple languages including python such as Java, Ruby..., Selenium have language bindings to allow Selenium to support multiple languages.The Selenium client library for Python provides bindings to interact with the WebDriver.
Python script:
python is used as scripting language which interacts and uses selenium webdriver. These scripts define the sequence of actions to be performed on the web browser, such as opening a webpage, clicking elements, filling forms and extracting data.Python serves as the programming language for creating and executing the automation scripts.

3. Browser Drivers:
web browsers (Chrome, Firefox, Edge) requires a specific driver to establish a connection with the Selenium WebDriver. These drivers establish connection between webdriver and respective browser For example, ChromeDriver is used with the Chrome browser, and GeckoDriver is used with Firefox.

4. JSON (JavaScript Object Notation) Wire Protocol:
The communication between the Selenium WebDriver and the browser driver is facilitated by the JSON Wire Protocol.It is a RESTful web service protocol,allowing for cross-browser compatibility.The communication between the client and server occurs through the HTTP protocol, a standardized protocol widely used for data transmission on
web browsers.

5. Web Browsers:
Selenium supports various browsers like Chrome, Firefox, Edge, Safari, and others.They act as intermediaries between the Selenium WebDriver and the respective browsers.The browser receives commands from the WebDriver,
executes them, and sends back the results to the WebDriver.

PYTHON VIRTUAL ENVIRONMENT

Python virtual environment is a tool helps to manage software dependencies.It keeps each project separate and safe from messing with others. It holds its own Python setup, including the Python language itself and any extra tools you need, like libraries or packages.It helps us to keep our projects organized and free from conflicts with each other.

Example:
when we working on two web-based Python projects Project X and Project Y, and they both require different versions of a particular library, “Newlibrary” . In such situations, we need to create a virtual environment, without this we might run into conflicts,create a virtual environment can be really useful to maintain the dependencies of both projects.

Top comments (0)