SeleniumBase/examples
Michael Mintz 86f7fa0cbe Update AngularJS waiting settings 2024-09-12 13:09:03 -04:00
..
behave_bdd Update and rename a behave-BDD test 2023-09-26 16:32:16 -04:00
boilerplates Update example tests 2024-02-26 11:59:18 -05:00
capabilities Update the documentation 2023-12-31 18:35:57 -05:00
case_plans
chart_maker
desktop_apps
dialog_boxes Update an example test 2024-02-15 21:28:24 -05:00
example_logs Update examples 2024-02-11 20:57:42 -05:00
master_qa
migration Update ReadMe files 2024-02-15 21:30:31 -05:00
offline_examples Update examples 2024-02-27 21:37:15 -05:00
presenter Update examples 2024-09-04 22:59:03 -04:00
tour_examples
translations Update the French example 2024-08-02 16:39:25 -04:00
unit_tests
visual_testing Update example tests 2023-11-09 20:30:05 -05:00
ReadMe.md Update the docs 2024-09-11 01:18:19 -04:00
__init__.py
basic_test.py
case_summary.md
coffee_cart_tests.py Update example tests 2023-11-01 02:00:31 -04:00
custom_settings.py Update AngularJS waiting settings 2024-09-12 13:09:03 -04:00
edge_test.py Update example tests 2023-10-27 03:34:25 -04:00
example_config.cfg
github_test.py Update example tests 2024-02-26 11:59:18 -05:00
gui_test_runner.py
hack_the_planet.py Update examples 2024-09-12 00:59:17 -04:00
handle_alert_test.py
iframe_tests.py
locale_code_test.py Update example tests 2023-11-09 00:06:51 -05:00
my_first_test.py Update example info 2024-02-11 21:50:55 -05:00
nth_child_test.py
old_wordle_script.py
parameterized_test.py Update example tests 2023-11-09 20:30:05 -05:00
performance_test.py
proxy_test.py Update example tests 2024-02-26 11:59:18 -05:00
pytest.ini
rate_limiting_test.py Update example tests 2024-02-26 11:59:18 -05:00
raw_ahrefs.py Update examples 2024-09-12 00:59:17 -04:00
raw_antibot_login.py Add more examples 2024-06-23 13:49:34 -04:00
raw_bing_captcha.py Update examples 2024-07-24 15:55:04 -04:00
raw_block.py Add more examples 2024-06-23 13:49:34 -04:00
raw_brotector_captcha.py Add more examples 2024-06-23 13:49:34 -04:00
raw_call.py Update examples 2024-03-07 20:45:31 -05:00
raw_cdp_logging.py Update examples 2024-08-02 18:46:50 -04:00
raw_cf.py Update examples 2024-09-04 22:59:03 -04:00
raw_cookies.py Update examples 2024-04-25 23:41:43 -04:00
raw_detection.py Add more examples 2024-06-23 13:49:34 -04:00
raw_driver_context.py Update examples 2024-02-23 00:18:46 -05:00
raw_driver_manager.py Update examples 2024-02-23 00:18:46 -05:00
raw_file_call.py
raw_form_turnstile.py Update examples 2024-08-02 18:46:50 -04:00
raw_games.py Update examples 2024-07-26 14:38:22 -04:00
raw_gui_click.py Update examples 2024-08-02 18:46:50 -04:00
raw_hobbit.py Add more examples 2024-06-23 13:49:34 -04:00
raw_login_context.py
raw_login_driver.py
raw_login_sb.py
raw_main_call.py
raw_mobile.py Update example tests 2023-10-13 15:50:45 -04:00
raw_multi_drivers.py Update examples 2024-03-07 20:45:31 -05:00
raw_nopecha.py Update examples 2024-09-12 00:59:17 -04:00
raw_order_tickets.py Update examples 2024-09-04 22:59:03 -04:00
raw_parameter_script.py Update options 2024-05-13 00:26:48 -04:00
raw_performance_logs.py Update examples 2024-05-03 17:33:27 -04:00
raw_pixelscan.py Update examples 2024-09-04 22:59:03 -04:00
raw_pyautogui.py Update examples 2024-08-02 18:46:50 -04:00
raw_recaptcha.py Update examples 2024-08-02 18:46:50 -04:00
raw_robot.py Update examples 2024-03-09 18:10:01 -05:00
raw_sb.py Update examples 2024-02-23 00:18:46 -05:00
raw_test_scripts.py
raw_turnstile.py Update examples 2024-07-08 16:58:44 -04:00
raw_uc_mode.py Update examples 2024-07-08 16:58:44 -04:00
sb_fixture_tests.py
setup.cfg
shadow_root_test.py Update example tests 2024-02-26 11:59:18 -05:00
swag_labs_user_tests.py
test_3d_apis.py Update examples 2024-03-09 18:10:01 -05:00
test_apple_site.py Update example tests 2024-02-26 11:59:18 -05:00
test_assert_elements.py
test_calculator.py
test_canvas.py Update example tests 2024-02-26 11:59:18 -05:00
test_cdp_ad_blocking.py Update example tests 2024-01-03 22:16:06 -05:00
test_checkboxes.py
test_chinese_pdf.py
test_chromedriver.py Update example tests 2024-02-26 11:59:18 -05:00
test_coffee_cart.py Update example tests 2023-11-09 20:30:05 -05:00
test_console_logging.py
test_contains_selector.py
test_cycle_elements.py
test_decryption.py
test_deferred_asserts.py
test_demo_site.py Update examples 2024-02-27 21:37:15 -05:00
test_detect_404s.py
test_docs_site.py Update examples 2024-03-30 22:17:14 -04:00
test_double_click.py Update example tests 2023-11-09 20:30:05 -05:00
test_download_files.py Update example tests 2024-03-21 17:30:52 -04:00
test_download_images.py Update example tests 2024-01-24 20:44:18 -05:00
test_drag_and_drop.py
test_error_page.py
test_event_firing.py
test_fail.py
test_geolocation.py Update examples 2024-09-12 00:59:17 -04:00
test_get_coffee.py Update example tests 2023-11-09 20:30:05 -05:00
test_get_locale_code.py
test_get_pdf_text.py
test_get_user_agent.py
test_hack_search.py Update example tests 2024-02-26 11:59:18 -05:00
test_highlight_elements.py Update examples 2024-05-03 17:33:27 -04:00
test_image_saving.py
test_inspect_html.py
test_login.py
test_markers.py
test_mfa_login.py
test_multiple_drivers.py Update example tests 2024-02-26 11:59:18 -05:00
test_null.py
test_override_driver.py Update example tests 2024-02-26 11:59:18 -05:00
test_override_sb_fixture.py Update example tests 2024-02-26 11:59:18 -05:00
test_parse_soup.py
test_pdf_asserts.py
test_pytest_parametrize.py Update example tests 2023-11-01 02:00:31 -04:00
test_repeat_tests.py Update example tests 2023-11-09 00:06:51 -05:00
test_request_sb_fixture.py
test_save_screenshots.py
test_sb_fixture.py
test_scrape_bing.py Update example tests 2023-12-19 18:34:42 -05:00
test_select_options.py
test_shadow_dom.py Update example tests 2024-02-26 11:59:18 -05:00
test_show_file_choosers.py
test_simple_login.py
test_skype_site.py Update example tests 2023-10-13 15:50:45 -04:00
test_suite.py
test_swag_labs.py
test_tinymce.py
test_todomvc.py Update example tests 2024-01-18 22:06:32 -05:00
test_url_asserts.py Update example tests 2023-11-01 02:00:31 -04:00
test_usefixtures.py
test_verify_chromedriver.py Update example tests 2024-02-26 11:59:18 -05:00
test_window_switching.py
test_xfail.py
test_xkcd.py
time_limit_test.py
uc_cdp_events.py Update examples 2024-08-02 18:46:50 -04:00
upgrade_chromedriver.py
upload_file_test.py
user_agent_test.py
verify_undetected.py Update examples 2024-08-01 13:22:05 -04:00
wordle_test.py
xpath_test.py
youtube_search_test.py Update example tests 2024-02-26 11:59:18 -05:00

ReadMe.md

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


Join the SeleniumBase chat on Discord Join the SeleniumBase chat on Discord!

Ask questions. Find answers. Learn how to automate!


Tested with SeleniumBase