1. Selenium Architecture:
Python Selenium architecture is a client-server model of Selenium Webdriv this enables automated interaction with web browser using python language.
Selenium Architecture flow:
Client(Selenium client Webdriver language) W3C Protocol(Webdriver) Browser Drivers Web Browser(Chrome, Firefox,Edge,etc)
Selenium Client Library(Python Binding) : This allows python API which allows user to write the automation scripts using Python language. This consist of methods and classes to interact with web elements, manage browser interactions, etc.
Webdriver Protocol (W3C) : COmmunication standard used to exchange data commands between the client and server (Browser drivers). Earlier selenium version uses JSON Wire protocol over HTTP. now Selenium webdriver 4 uses W3C protocol , its a standardized approach that ensures better compatibility across browsers.
Browser Drivers : Each browser have a specific executable drivers. It act as an intermediary to receive and send commands through the Webdriver protocol to the browsers.
Real Browsers: Its a actual browsers where the automation takes place. Browser executes the code written in python in the browser by receiveing commands from its driver and send the execution status(Test Pass, Fail or data) back to driver as an HTTP response.
Actual flow of Selenium Test using python language in Selenium Webdriver 4:
Step 1: In IDE, user writes the script using python language.
Step 2: Once the script runs, W3C protocol send the instruction to the Web drivers.
Step 3: Browser driver receives HTTP commands and translate based on its library to the real browsers.
Step 4: Browser receives the command and executes the scripts in the browser and send back the status to Web drivers through HTTP response.
2. Significance of Python Virtual Environment:
- Dependency Management : Each project can have its own set of libraries.
- Isolation from System Python : Virtual Environment prevent accidental modification of the global python installation, keeping the system stable.
- Reproducibility : By freezing dependencies in a requirement file, developers can recreate same environment across machines, ensuring the behaviour consistent in development, testing and deployment.
- Simplified Project Management : Each environment is self-contained, making it easier to manage, replicate, and share setups with teammates.
Examples:
Web Development :
Without Virtual Environment : Installing any extensions globally may break older projects when upgrading.
With Virtual Environment : Each project runs its required extension version independently.Team Collaboration:
Without Virtual Environment : Developers may face “works on my machine” issues.
With Virtual Environment : Sharing the requirement file (.txt) ensures identical environments for all team members
Top comments (0)