SeleniumBase/examples
Michael Mintz 49143fce9e Update available command-line options 2022-02-01 22:37:07 -05:00
..
boilerplates Refactor the tests 2021-05-05 21:06:24 -04:00
capabilities Update the docs 2021-12-24 17:36:27 -05:00
chart_maker Update the docs 2021-08-19 19:21:21 -04:00
desktop_apps The Recorder Mode GUI Desktop App: Deluxe Edition 2021-12-17 04:33:45 -05:00
dialog_boxes Update an example test 2022-01-27 01:45:34 -05:00
example_logs Update the docs 2021-11-03 23:28:13 -04:00
master_qa Add a custom "pytest.ini" to MasterQA examples 2021-05-24 16:04:29 -04:00
migration Update the example tests 2022-02-01 14:56:26 -05:00
offline_examples Update the example tests 2022-02-01 14:56:26 -05:00
presenter Update example tests 2021-09-26 15:05:21 -04:00
tour_examples Update the docs 2021-10-22 16:27:08 -04:00
translations Update a test 2021-11-27 13:12:42 -05:00
unit_tests Update the unit tests 2022-01-27 01:42:40 -05:00
visual_testing Update an example test 2021-12-03 00:40:44 -05:00
ReadMe.md Update the docs 2022-02-01 01:04:06 -05:00
__init__.py Fresh Copy 2015-12-04 16:11:53 -05:00
basic_test.py Update the example tests 2022-02-01 14:56:26 -05:00
custom_settings.py Set "WAIT_FOR_RSC_ON_CLICKS" to be False by default 2021-12-03 00:08:30 -05:00
edge_test.py Update example tests 2022-01-04 20:47:15 -05:00
example_config.cfg Update example config files 2018-03-05 17:33:07 -05:00
fail_if_old_driver_test.py Update example tests 2021-08-23 20:25:57 -04:00
github_test.py Update example tests 2021-12-03 00:09:07 -05:00
gui_test_runner.py Refactor the tests 2021-05-05 21:06:24 -04:00
hack_the_planet.py Update an example script 2021-12-26 12:15:23 -05:00
handle_alert_test.py Update example tests 2021-12-03 00:09:07 -05:00
image_test.py Refactor the tests 2021-05-05 21:06:24 -04: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-02-01 00:59:15 -05:00
nth_child_test.py Refactor the tests 2021-05-05 21:06:24 -04:00
parameterized_test.py Update the example tests 2021-10-05 17:33:07 -04:00
proxy_test.py Update an example test 2021-11-15 13:46:37 -05:00
pytest.ini Use the IPython debugger by default (ipdb) 2021-05-10 19:15:14 -04:00
rate_limiting_test.py Refactor the tests 2021-05-05 21:06:24 -04:00
raw_browser_launcher.py Add an example that can be run with pure "python" 2022-01-27 01:47:59 -05:00
raw_parameter_script.py Update available command-line options 2022-02-01 22:37:07 -05:00
setup.cfg Update the "flake8" style guide rules 2022-01-27 01:44:54 -05:00
shadow_root_test.py Update a Shadow Root test 2021-11-25 12:40:09 -05:00
swag_labs_suite.py Update the example tests 2022-02-01 14:56:26 -05:00
test_agent.py Update example tests 2022-01-11 22:45:28 -05:00
test_apple_site.py Update an example test 2021-06-18 11:52:58 -04:00
test_checkboxes.py Update example tests 2021-09-26 15:05:21 -04:00
test_chinese_pdf.py Update example tests 2021-07-29 11:40:15 -04:00
test_chromedriver.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_contains_selector.py Update an example that uses the ":contains()" selector 2021-07-29 21:25:50 -04:00
test_decryption.py Rename a test 2021-11-25 12:40:30 -05:00
test_deferred_asserts.py Update an example test that uses deferred asserts 2021-11-10 12:57:29 -05:00
test_demo_site.py Update example tests 2022-01-11 22:45:28 -05:00
test_detect_404s.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_docs_site.py Update example tests 2021-10-18 01:48:48 -04:00
test_double_click.py Update example tests 2021-09-26 15:05:21 -04:00
test_download_files.py Update example tests 2022-02-01 00:59:15 -05:00
test_drag_and_drop.py Update example tests 2021-09-26 15:05:21 -04:00
test_error_page.py Refactor the tests 2021-05-05 21:06:24 -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 2021-07-29 11:40:15 -04:00
test_get_user_agent.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_hack_search.py Update the example tests 2021-10-05 17:33:07 -04:00
test_iframes.py Update example tests 2021-09-26 15:05:21 -04:00
test_inspect_html.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_login.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_markers.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_mfa_login.py Update an example test 2021-11-02 02:11:48 -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_parse_soup.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_pdf_asserts.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_pytest_parametrize.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_repeat_tests.py Update example tests 2021-10-18 23:52:04 -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 2021-07-21 13:23:53 -04:00
test_shadow_dom.py Update example tests 2022-01-04 20:47:15 -05:00
test_show_file_choosers.py Update the example tests 2022-02-01 14:56:26 -05:00
test_skype_site.py Update the example tests 2021-10-05 17:33:07 -04:00
test_suite.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_swag_labs.py Update example tests 2022-02-01 00:59:15 -05: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 an example test 2021-07-20 13:51:42 -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 Refactor the tests 2021-05-05 21:06:24 -04:00
upgrade_chromedriver.py Change a test class name to allow discovery w/o pytest.ini 2021-10-20 11:40:48 -04:00
upload_file_test.py Update example tests 2021-10-01 01:25:22 -04:00
user_agent_test.py Update the example tests 2022-02-01 14:56:26 -05:00
wordle_test.py Update an example test 2022-01-27 01:46:10 -05:00
xpath_test.py Update example tests 2022-02-01 00:59:15 -05:00
youtube_search_test.py Update example tests 2021-08-23 20:25:57 -04:00

ReadMe.md

SeleniumBase

Running 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 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 tests with verbose output: (includes more details)

pytest test_suite.py -v

Run a test on the Demo Site to try many SeleniumBase methods:

pytest test_demo_site.py


Run tests 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 an example test suite that demonstrates the use of pytest markers:

pytest -m marker_test_suite -v

Run an example 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

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