-
Install Python 3.9 or above
-
Install Pycharm Community Edition
-
File > New > Project > New Project
Name: YourProjectName Location: Your project location Environment: Generate new Type: Virtualenv Base Python: Your python location
-
pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/ -
pip3 config set install.trusted-host mirrors.aliyun.com
-
pip3 install pdm -
pdm init-
Select the venv you just created
-
Press the Enter for others
-
-
pdm add pytest -
pdm add selenium -
pdm add webdriver_manager
-
Add classes under /src/package
-
The ChromeDriverManager will download chromedriver automatically in runtime
webdriver.Chrome(service=Service(ChromeDriverManager().install()))
- Add classes under /tests/package
- Add classes under /tests/package
If you would like to use example codes from this repo, follow these steps:
- Copy the src directory to yourProject
-
Right-click on the method name in the code editor and select:
- Run testCannotLoginAsTest()
-
Click on the method name in the code editor and press the key combination:
- ctrl + shift + F10
- Run
pytest tests/test_login.py::testCannotLoginAsTest