Selenium is designed to automate web browsers by sending commands from test scripts to browsers and receiving responses back. It basically follows a Client-Server architecture.
Main Components of Selenium Architecture:
-->Test Scripts(client language)
-->Selenium client Library
-->W3C webDriver Protocol
-->Browser Drivers
-->Real Browser
Test Script(Client Language):
It is basically written by tester using this programming languages:
-->c#
-->Java
-->Javascript
Example:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://google.com")
Selenium client Library:
It is a language-specific binding by selenium. Test Script and selenium WebDriver converts as a python commands into standard WebDriver commands.
Example: selenium-python, selenium-java, selenium-dotnet.
W3C WebDriver Protocol
A communication protocol used to send commands from Selenium client to the browser driver.
It enables language-independent communication and ensures uniform interaction between Selenium and browsers.
Browser Drivers:
Each browser has its own Driver
Chrome - ChromeDriver
Firefox - GeckoDriver
Edge - EdgeDriver
Safari - SafariDriver
Example: driver.find_element(BY.ID, "login").click()
Real Browser:
The actual browser installed on the system.
Executes:
Clicks
Typing
Page navigation
Returns results (success, failure, error).
SIGNIFICANCE OF PYTHON VIRTUAL ENVIRONMENT
A python Virtual Environment(venv) that allows you to install and manage python packages separately for each project without any conflicts of other projects.
Examples of Virtual Environment Usage
Example: Selenium Automation Project
pip install selenium pytest webdriver-manager
->Installed only for this automation project
->No impact on other projects
Tools for Virtual Environments:
Tools and Description
1.venv-->Built-in (recommended)
2.virtualenv-->Advanced features
3.conda-->Popular in data science
4.pipenv-->Combines pip + venv
5.poetry-->Dependency management
Summary
Python virtual environments make our projects independent, stable, and maintainable.
Top comments (0)