SeleniumBase/examples
Michael Mintz af9f47dc89 Update example tests 2022-10-20 00:02:55 -04:00
..
behave_bdd Update the documentation 2022-08-05 18:27:38 -04:00
boilerplates Update example tests 2022-10-14 03:58:18 -04:00
capabilities Update documentation 2022-07-05 19:23:40 -04:00
case_plans Add SeleniumBase Case Plans 2022-08-17 02:04:48 -04:00
chart_maker Update the documentation 2022-08-05 18:27:38 -04:00
desktop_apps The Recorder Mode GUI Desktop App: Deluxe Edition 2021-12-17 04:33:45 -05:00
dialog_boxes Update the documentation 2022-08-05 18:27:38 -04:00
example_logs Update the documentation 2022-10-10 19:56:32 -04:00
master_qa Refactor examples 2022-04-13 13:40:01 -04:00
migration Update example tests 2022-10-20 00:02:55 -04:00
offline_examples Update example tests 2022-09-20 21:48:28 -04:00
presenter Update the documentation 2022-08-05 18:27:38 -04:00
tour_examples Update the documentation 2022-09-17 22:21:39 -04:00
translations Tell Python to ignore special characters in linters 2022-09-25 07:52:40 -04:00
unit_tests Update the unit tests 2022-02-05 23:06:30 -05:00
visual_testing Update documentation 2022-10-14 03:59:53 -04:00
ReadMe.md Update the documentation 2022-09-15 23:02:16 -04:00
__init__.py Fresh Copy 2015-12-04 16:11:53 -05:00
basic_test.py Update example tests 2022-08-15 21:00:38 -04:00
case_summary.md Add "case_summary.md" 2022-08-18 15:49:52 -04:00
custom_settings.py Update example tests 2022-08-26 22:01:13 -04:00
edge_test.py Update examples 2022-05-13 16:19:05 -04:00
example_config.cfg Update example config files 2018-03-05 17:33:07 -05:00
github_test.py Update example tests 2022-10-14 03:58:18 -04:00
gui_test_runner.py Update the GUI Test Runner 2022-02-11 01:11:33 -05:00
hack_the_planet.py Update example tests 2022-09-08 22:28:02 -04:00
handle_alert_test.py Update example tests 2021-12-03 00:09:07 -05:00
list_assert_test.py Update example tests 2022-02-01 00:59:15 -05:00
locale_code_test.py Refactor the tests 2021-05-05 21:06:24 -04:00
my_first_test.py Update example tests 2022-08-15 21:00:38 -04:00
nth_child_test.py Update example tests 2022-08-26 22:01:13 -04:00
parameterized_test.py Update example tests 2022-07-15 19:11:37 -04:00
performance_test.py Update example tests 2022-10-10 19:57:06 -04:00
proxy_test.py Update example tests 2022-08-04 14:10:41 -04:00
pure_python.py Update example tests 2022-04-18 01:28:14 -04:00
pytest.ini Use the IPython debugger by default (ipdb) 2021-05-10 19:15:14 -04:00
rate_limiting_test.py Update example tests 2022-08-12 14:59:44 -04:00
raw_browser_launcher.py Update example tests 2022-10-20 00:02:55 -04:00
raw_driver.py Update example tests 2022-10-20 00:02:55 -04:00
raw_parameter_script.py Update example tests 2022-10-14 03:58:18 -04:00
raw_sb.py Update example tests 2022-10-20 00:02:55 -04:00
raw_test_scripts.py Update example tests 2022-10-20 00:02:55 -04:00
setup.cfg Create the SeleniumBase-Behave integration 2022-05-13 15:57:30 -04:00
shadow_root_test.py Update a Shadow Root test 2021-11-25 12:40:09 -05:00
swag_labs_user_test.py Update a test 2022-10-02 10:17:14 -04:00
test_agent.py Update example tests 2022-04-22 03:00:48 -04:00
test_apple_site.py Update example tests 2022-10-01 20:29:20 -04:00
test_calculator.py Add a calculator example test 2022-07-05 20:08:00 -04:00
test_canvas.py Update example tests 2022-06-23 23:25:19 -04:00
test_checkboxes.py Update example tests 2022-08-26 22:01:13 -04:00
test_chinese_pdf.py Update example tests 2022-08-12 14:59:44 -04:00
test_chromedriver.py Update example tests 2022-05-26 20:14:48 -04:00
test_coffee_cart.py Add an example test: "test_coffee_cart.py" 2022-08-18 15:25:47 -04:00
test_contains_selector.py Update comments 2022-04-26 10:49:00 -04:00
test_cycle_elements.py Add test that tabs through and clicks the active element 2022-07-03 15:48:46 -04:00
test_decryption.py Rename a test 2021-11-25 12:40:30 -05:00
test_deferred_asserts.py Update example tests 2022-05-25 22:06:36 -04:00
test_demo_site.py Update example tests 2022-09-20 21:48:28 -04:00
test_detect_404s.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_docs_site.py Update example tests 2022-08-04 14:10:41 -04:00
test_double_click.py Update example tests 2022-08-26 22:01:13 -04:00
test_download_files.py Update example tests 2022-07-01 14:23:56 -04:00
test_download_images.py Add new example test: "test_download_images.py" 2022-08-14 00:06:46 -04:00
test_drag_and_drop.py Update example tests 2022-08-26 22:01:13 -04:00
test_error_page.py Update examples 2022-06-06 23:50:26 -04:00
test_event_firing.py Update example tests 2022-02-01 00:59:15 -05:00
test_fail.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_get_locale_code.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_get_pdf_text.py Update example tests 2022-08-12 14:59:44 -04:00
test_get_user_agent.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_hack_search.py Refactoring 2022-06-24 14:14:17 -04:00
test_iframes.py Update example tests 2022-08-26 22:01:13 -04:00
test_image_saving.py Update example tests 2022-09-24 01:42:16 -04:00
test_inspect_html.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_login.py Update example tests 2022-08-18 16:01:37 -04:00
test_markers.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_mfa_login.py Update example tests 2022-10-14 03:58:18 -04:00
test_multiple_drivers.py Add an example test that uses multiple drivers 2022-01-08 20:25:05 -05:00
test_null.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_override_driver.py Update an example test 2022-09-21 22:38:32 -04:00
test_override_sb_fixture.py Update example tests 2022-10-20 00:02:55 -04:00
test_parse_soup.py Update an example test 2022-04-10 10:51:12 -04:00
test_pdf_asserts.py Update example tests 2022-08-12 14:59:44 -04:00
test_pytest_parametrize.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_repeat_tests.py Refactor examples 2022-04-13 13:40:01 -04:00
test_request_sb_fixture.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_save_screenshots.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_sb_fixture.py Update example tests 2022-08-26 22:01:13 -04:00
test_scrape_bing.py Update example tests 2022-08-12 14:59:44 -04:00
test_select_options.py Add an example test: "test_select_options.py" 2022-08-18 15:26:16 -04:00
test_shadow_dom.py Update example tests 2022-06-10 22:14:17 -04:00
test_show_file_choosers.py Update the example tests 2022-02-01 14:56:26 -05:00
test_skype_site.py Update example tests 2022-06-07 23:36:34 -04:00
test_suite.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_swag_labs.py Update comments 2022-10-02 01:11:11 -04:00
test_tinymce.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_todomvc.py Update the example tests 2021-10-05 17:33:07 -04:00
test_usefixtures.py Update example tests 2022-10-14 03:58:18 -04:00
test_verify_chromedriver.py Rename a test 2022-08-15 20:59:30 -04:00
test_window_switching.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_xfail.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_xkcd.py Update example tests 2022-02-01 00:59:15 -05:00
time_limit_test.py Update example tests 2022-10-10 19:57:06 -04:00
upgrade_chromedriver.py Update example tests 2022-10-01 20:29:20 -04:00
upload_file_test.py Update example tests 2022-08-26 22:01:13 -04:00
user_agent_test.py Update example tests 2022-04-22 03:00:48 -04:00
verify_undetected.py Update an example test 2022-09-05 16:03:09 -04:00
wordle_archive_test.py Update example tests 2022-09-20 16:48:42 -04:00
wordle_test.py Update example tests 2022-10-14 03:58:18 -04:00
xpath_test.py Refactor examples 2022-04-13 13:40:01 -04:00
youtube_search_test.py Update examples 2022-06-15 13:42:17 -04: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 in Chrome: (Default: --browser=chrome)

pytest my_first_test.py


Run an example test on the SeleniumBase Demo Site:

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

Tested with SeleniumBase