Skip to content

📚 Running Example Tests

Example Tests

SeleniumBase Demo Page

(NOTE: Some example tests fail on purpose to demonstrate logging features.)


Example tests with run commands to help you get started:


Run an example test: (Default option: --browser=chrome)

pytest test_demo_site.py



Run an example test in Firefox:

pytest my_first_test.py --browser=firefox

Run an example test in Demo Mode: (highlight assertions)

pytest test_swag_labs.py --demo



Run test_coffee_cart.py to test the Coffee Cart app:

pytest test_coffee_cart.py --demo

SeleniumBase Example


Run a Wordle-solver example:

pytest wordle_test.py



Run an example test in Headless Mode: (invisible browser)

pytest my_first_test.py --headless

Run an example test using Chrome's mobile device emulator: (default settings)

pytest test_swag_labs.py --mobile



Run another example test in Demo Mode: (highlight assertions)

pytest test_xkcd.py --demo



Run a test suite with verbose output: (see more details)

pytest test_suite.py -v

Run a test suite multi-threaded using [n] threads:

pytest test_suite.py -n=4

Run a parameterized test: (Generates multiple tests from one)

pytest parameterized_test.py -v

Run a test suite and generate a SeleniumBase Dashboard:

pytest test_suite.py --dashboard

Run a test suite and generate a pytest report:

pytest test_suite.py --html=report.html

Run a failing test: (See the latest_logs/ folder for logs and screenshots)

pytest test_fail.py

Run a failing test with Debug-mode enabled: (pdb activates on failures)

pytest test_fail.py --pdb -s

Run a test suite that demonstrates the use of pytest markers:

pytest -m marker_test_suite -v

Run a test suite that reuses the browser session between tests:

pytest test_suite.py --reuse-session

Run an example test demonstrating the rate_limited Python decorator:

pytest rate_limiting_test.py

Run an example test that demonstrates how to upload a file to a website:

pytest upload_file_test.py

Try the new SeleniumBase Commander! A GUI for pytest:

sbase gui



SeleniumBase tests can also be run with nosetests:

Run an example test with nosetests:

nosetests my_first_test.py

Run an example test suite and generate a nosetest report:

nosetests test_suite.py --report --show-report

Run an example test using a nosetest configuration file:

nosetests my_first_test.py --config=example_config.cfg

For more advanced run commands, such as using a proxy server, see ../help_docs/customizing_test_runs.md


If you just need to perform some quick website verification on various devices, you can use the SeleniumBase Device Farm. Just plug in a website URL, and it will display how the website looks on four different devices:



To make things easier, here's a simple GUI program that allows you to run a few example tests by pressing a button:

python gui_test_runner.py

(The newer SeleniumBase Commander improves on that.)


🎖ī¸ To launch the SeleniumBase Commander GUI for pytest:

sbase gui


Tested with SeleniumBase