Lesson 1 of 87 min read
Create an isolated Python test environment
Use Python 3.11 or newer and a separate virtual environment for this project. Invoke pip and pytest through the same Python interpreter; otherwise a globally installed pytest can miss the packages you just installed. Selenium Manager normally handles the browser driver when Chrome is installed. It still needs network access for the first driver download. Record the interpreter and dependency versions with your test evidence. These lessons use a local practice page, never a customer's production website.
Key takeaways
- 1Create the environment, install dependencies and save requirements.txt. Run python -c "import selenium, pytest; print(selenium.__version__)".
- 2The import command prints the installed Selenium version. Save your actual output, not an example version.
- 3Use the synthetic local shop; never automate a real customer's account without authorization.
Run in your own practice environment
python -m venv .venv
# macOS/Linux:
source .venv/bin/activate
# Windows PowerShell instead:
# .venv\Scripts\Activate.ps1
python -m pip install selenium pytest requests
python -m pip freeze > requirements.txt
python -m pytest --version
Go deeper
Expert notes beyond the basics
- 01
From example to evidence
Use Python 3.11 or newer and a separate virtual environment for this project. Invoke pip and pytest through the same Python interpreter; otherwise a globally installed pytest can miss the packages you just installed. Selenium Manager normally handles the browser driver when Chrome is installed. It still needs network access for the first driver download. Record the interpreter and dependency versions with your test evidence. These lessons use a local practice page, never a customer's production website.
- 02
Scope the result honestly
The import command prints the installed Selenium version. Save your actual output, not an example version. Run this case locally and save the actual outcome. The website knowledge check verifies your answer, not an executed browser session.
Common mistakes to avoid
- - Skipping the local fixture setup before running the browser example.
- - Copying output instead of observing your own run.
Try it yourself
Create the environment, install dependencies and save requirements.txt. Run python -c "import selenium, pytest; print(selenium.__version__)".
Write your answer on paper or in a sheet first, then compare.
Interview questions
How to answer like a confident QA engineer
- Q1
Why invoke pip through python -m?
Model answer
It selects that interpreter's package installer. The import command prints the installed Selenium version. Save your actual output, not an example version.
- Q2
How would you prove this check can detect a regression?
Model answer
Change the expected result deliberately, observe a failed assertion, then restore the correct contract and rerun.
Knowledge check
+5 points
Why invoke pip through python -m?
