SeleniumBase/examples
Michael Mintz 2a46f6f6a9 Change a test class name to allow discovery w/o pytest.ini 2021-10-20 11:40:48 -04:00
..
boilerplates Refactor the tests 2021-05-05 21:06:24 -04:00
capabilities Update the docs 2021-09-06 12:58:41 -04:00
chart_maker Update the docs 2021-08-19 19:21:21 -04:00
dialog_boxes Update the docs 2021-10-02 11:49:33 -04:00
example_logs Update the docs 2021-10-18 23:50:47 -04:00
master_qa Add a custom "pytest.ini" to MasterQA examples 2021-05-24 16:04:29 -04:00
migration Update the docs 2021-06-04 21:56:14 -04:00
offline_examples Refactor the tests 2021-05-05 21:06:24 -04:00
presenter Update example tests 2021-09-26 15:05:21 -04:00
tour_examples Update the docs 2021-10-02 11:49:33 -04:00
translations Update an example test 2021-10-14 03:14:45 -04:00
unit_tests Refactor the tests 2021-05-05 21:06:24 -04:00
visual_testing Update the docs 2021-08-11 00:00:22 -04:00
ReadMe.md Update the docs 2021-10-18 01:49:29 -04:00
__init__.py Fresh Copy 2015-12-04 16:11:53 -05:00
basic_test.py Perform syntax refactoring on example tests 2021-05-03 22:39:14 -04:00
custom_settings.py Update the custom_settings parser 2021-10-01 01:25:06 -04:00
decryption_test.py Refactor the tests 2021-05-05 21:06:24 -04:00
edge_test.py Refactor the tests 2021-05-05 21:06:24 -04: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-09-01 01:28:57 -04:00
gui_test_runner.py Refactor the tests 2021-05-05 21:06:24 -04:00
hack_the_planet.py Update example tests 2021-09-20 03:23:17 -04:00
handle_alert_test.py Refactor the tests 2021-05-05 21:06:24 -04:00
image_test.py Refactor the tests 2021-05-05 21:06:24 -04:00
list_assert_test.py Refactor the tests 2021-05-05 21:06:24 -04:00
locale_code_test.py Refactor the tests 2021-05-05 21:06:24 -04:00
my_first_test.py Update the docs 2021-06-07 11:13:10 -04: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 Refactor the tests 2021-05-05 21:06:24 -04: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_parameter_script.py Add "Recorder Mode" 2021-09-20 03:09:31 -04:00
setup.cfg Add "Recorder Mode" 2021-09-20 03:09:31 -04:00
swag_labs_suite.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_agent.py Refactor the tests 2021-05-05 21:06:24 -04: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_deferred_asserts.py Refactor the tests 2021-05-05 21:06:24 -04:00
test_demo_site.py Update examples 2021-10-08 23:55:09 -04: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 Refactor the tests 2021-05-05 21:06:24 -04: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 Refactor the tests 2021-05-05 21:06:24 -04: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_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 examples and docs 2021-05-22 14:15:36 -04:00
test_show_file_choosers.py Update an example test 2021-10-08 00:58:30 -04: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 2021-10-18 01:48:48 -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 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
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 Refactor the tests 2021-05-05 21:06:24 -04:00
xpath_test.py Refactor the tests 2021-05-05 21:06:24 -04:00
youtube_search_test.py Update example tests 2021-08-23 20:25:57 -04:00

ReadMe.md

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 my_first_test.py --demo


Run a different example in Demo Mode:

pytest test_swag_labs.py --demo


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