Framework is no longer maintained, check Playwright instead - https://github.com/giant-whale/playwright-python-framework
This is a python PageObject framework for Selenoid hub, replacement of Selenium hub.
Read more about Selenoid — https://aerokube.com/selenoid/
Python 3.11
- Follow this guide to install and run Selenoid — https://aerokube.com/selenoid/latest/
- Download Docker images with browsers for Selenoid. If you want to use VNC option, you have to download VNC versions too;
- Create new virtual environment and use package manager pip to install all requirements:
pip install -r requirements.txt
; - Follow this guide to install Allure — https://docs.qameta.io/allure/#_get_started
Before running tests, change SELENOID_REMOTE_URL
variable in core/settings.py
to your Selenoid address.
List of available browsers in core/browsers.py
. To add and use more browsers, check Selenoid documentation – https://aerokube.com/selenoid/latest/#_browser_images
Mobile emulation is available only for Google Chrome.
Usage: add decorator @pytest.mark.mobile
to your test on class to use mobile emulation.
To add more mobile devices:
- Add new mark to
pytest.ini
; - Add new devices in
core/mobile_emulation.py
; - Change
is_mobile
function inconftest.py
— it requires new logic; - Add new branch for driver setup in
conftest.py
.
Multiple threads:
- Single-thread — execute command
pytest tests/
to run all tests in 1 thread; - Multi-thread — execute command
pytest tests/ -n 5
to run all tests in 5 threads.
Select browser:
- Execute command
pytest tests/ --browser=chrome
to run all tests using Google Chrome. Also, it's declared as default browser, so there is no need to use this command — you can usepytest tests/
instead; - Execute command
pytest tests/ --browser=firefox
to run all tests using Mozilla Firefox;
Generate Allure report:
- Execute command
pytest tests/ --alluredir=./allure_results
to run all tests and generate Allure report files in directory./allure_reports
. To run human-readable Allure report, execute command from the same directoryallure serve ./allure_results
.