Skip to content

Files

Latest commit

9bde7e7 · Mar 22, 2025

History

History

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Sep 26, 2023
Feb 13, 2025
Dec 31, 2023
Mar 25, 2023
Mar 22, 2025
Jul 3, 2023
Feb 4, 2023
Sep 23, 2024
Sep 23, 2024
Dec 6, 2024
Dec 6, 2024
Feb 28, 2024
Mar 5, 2025
Mar 20, 2025
Dec 15, 2024
Feb 18, 2023
Nov 10, 2023
Dec 15, 2024
Feb 3, 2023
Mar 1, 2023
Mar 25, 2023
Nov 1, 2023
Sep 23, 2024
Oct 27, 2023
Feb 3, 2023
Nov 4, 2024
Feb 3, 2023
Dec 30, 2024
Sep 26, 2024
Jul 31, 2023
Nov 9, 2023
Feb 1, 2025
Feb 12, 2024
Aug 5, 2023
Aug 15, 2023
Nov 10, 2023
Mar 1, 2023
Mar 21, 2025
Dec 6, 2024
Feb 26, 2024
Feb 26, 2025
Jun 23, 2024
Jul 24, 2024
Jun 23, 2024
Jun 23, 2024
Mar 8, 2024
Feb 1, 2025
Aug 2, 2024
Feb 26, 2025
Apr 26, 2024
Jun 23, 2024
Feb 23, 2024
Feb 23, 2024
Feb 18, 2023
Aug 2, 2024
Feb 12, 2025
Feb 13, 2025
Feb 13, 2025
Jun 23, 2024
Jan 21, 2025
Sep 24, 2023
Sep 24, 2023
Sep 24, 2023
Apr 19, 2023
Oct 13, 2023
Mar 8, 2024
Sep 12, 2024
Sep 5, 2024
Sep 26, 2024
May 3, 2024
Jan 22, 2025
Feb 13, 2025
Jan 21, 2025
Mar 9, 2024
Feb 23, 2024
Jan 9, 2025
Feb 22, 2025
Jul 8, 2024
Jul 8, 2024
Sep 24, 2023
Feb 3, 2023
Feb 26, 2024
Mar 1, 2023
Mar 9, 2024
Feb 26, 2024
Mar 9, 2023
Jan 26, 2023
Feb 26, 2024
Feb 13, 2025
Feb 3, 2023
Feb 3, 2023
Oct 6, 2024
Nov 10, 2023
Jan 19, 2023
Jan 19, 2023
Jan 19, 2023
Feb 3, 2023
Feb 3, 2023
Feb 28, 2024
Feb 3, 2023
Mar 31, 2024
Nov 10, 2023
Dec 15, 2024
Jan 25, 2024
Feb 3, 2023
Jul 18, 2023
Feb 3, 2023
Feb 3, 2023
Sep 12, 2024
Nov 10, 2023
Feb 3, 2023
Feb 3, 2023
Dec 15, 2024
Feb 3, 2023
Sep 23, 2024
May 3, 2024
Feb 3, 2023
Feb 3, 2023
Mar 23, 2023
Feb 3, 2023
Feb 3, 2023
Feb 26, 2024
Feb 3, 2023
Feb 26, 2024
Feb 26, 2024
Sep 23, 2024
Feb 3, 2023
Nov 1, 2023
Nov 9, 2023
May 6, 2021
Feb 3, 2023
Sep 24, 2023
Dec 19, 2023
Jan 15, 2023
Sep 23, 2024
Feb 3, 2023
Sep 24, 2023
Oct 13, 2023
Mar 4, 2023
Mar 1, 2023
Sep 23, 2024
Jan 19, 2024
Nov 1, 2023
Feb 20, 2025
Feb 26, 2024
Jan 13, 2023
Feb 3, 2023
Feb 3, 2023
Mar 4, 2023
Jan 21, 2025
Aug 5, 2023
Feb 3, 2023
Aug 5, 2023
Jan 21, 2025
Aug 15, 2023
Feb 3, 2023
Jan 25, 2025

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: --chrome)

pytest my_first_test.py



Here's one way of changing the browser to Firefox:

pytest my_first_test.py --firefox

Another example test for a web page that has lots of different HTML items:

pytest test_demo_site.py



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 an 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 using multiple parallel processes (-n=NUM):

pytest test_suite.py -n=8

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 that activates pdb debug mode on failure:

pytest test_fail.py --pdb -s

(pdb commands: n, c, s, u, d => next, continue, step, up, down)


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 --rs

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

🎖️ SeleniumBase Commander is a GUI for pytest:

sbase gui



SeleniumBase tests can also be run with pynose:

pynose my_first_test.py

Run an example test suite and generate a pynose test report:

pynose test_suite.py --report --show-report

Run an example test using a pynose configuration file:

pynose 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.)


Ask questions. Find answers. Learn how to automate!


Tested with SeleniumBase