Python selenium archtecture is a layered system that allows developers to automate web browsers using the selenium webdriver APL.
- Client Layer(Test Script Layer)
*Languages supported:
selenium supports multiple languages like python,java,c#, ruby,and javaScriot, in our case Python is used.
*Bindings:
The python bindings are wrappers that translate python commands into http requests understood by webdriver.
- Selenium web driver API
- webdriver is an interface that defines a set method for iterfacing with browsers (.get(),.click(),.send_keys(),etc.)
- The webdriver API is language independent. Whenusing python,python binding convert method calls to JSON over HTTP.
- JSON wire protocol/W3C webdriver protocal
This is communication protocol that enables communication between the client and the browser driver.
In older versions selenium used the JSON wire protocol.
- BROWSER DRIVERS:
- These are executables that act as middlemen between selenium and browsers.
Examples:
- chromedriver for google chrome.
- geckodriver for firefox
- msedgedriver for microsoft edge.
- BROWSERS.
- The driver controls the browser to perform tasks like loading pages, clicking buttons filling forms. etc.
- The browsers sends responses back to the driver, which sends them back to the client.
PYTHON VIRTUAL ENVIRONMENT
- Dependency isolotion:
- Prevents version conflicts between packages.
- Each project can have its own set of dependencies.
- Project portability:
- Makes it easier to share projects (using requirments.txt) without worrying about system wide pacjages.
3.Cleaner global environmrnt:
- keeps the global python installation untouched and clean
4.Reproducibillity:
- Help in reproducing exact environment for development, testing and deployment.
EXAMPLE:
1.Without virtual environment
You install Flask==2.0.0 for project A.later,project B need Flask==1.1.2. installing both globally causes conflicts.
2.With virtual environment:
Project A
python -m venv venvA
source venvA/bin/activate
pip install Flask==2.0.0
Project B
python -m venv venvB
source venvB/bin/activate
pip install Flask==1.1.2
Each project run independently without conflict.
Top comments (0)