fd33cad4cf | ||
---|---|---|
.. | ||
behave_bdd | ||
boilerplates | ||
capabilities | ||
case_plans | ||
cdp_mode | ||
chart_maker | ||
desktop_apps | ||
dialog_boxes | ||
example_logs | ||
master_qa | ||
migration | ||
offline_examples | ||
presenter | ||
tour_examples | ||
translations | ||
unit_tests | ||
visual_testing | ||
ReadMe.md | ||
__init__.py | ||
basic_test.py | ||
case_summary.md | ||
coffee_cart_tests.py | ||
custom_settings.py | ||
edge_test.py | ||
example_config.cfg | ||
github_test.py | ||
gui_test_runner.py | ||
hack_the_planet.py | ||
handle_alert_test.py | ||
iframe_tests.py | ||
locale_code_test.py | ||
my_first_test.py | ||
nth_child_test.py | ||
old_wordle_script.py | ||
parameterized_test.py | ||
performance_test.py | ||
proxy_test.py | ||
pytest.ini | ||
rate_limiting_test.py | ||
raw_ahrefs.py | ||
raw_antibot_login.py | ||
raw_bing_captcha.py | ||
raw_block.py | ||
raw_brotector_captcha.py | ||
raw_call.py | ||
raw_cdp_logging.py | ||
raw_cf.py | ||
raw_cookies.py | ||
raw_detection.py | ||
raw_driver_context.py | ||
raw_driver_manager.py | ||
raw_file_call.py | ||
raw_form_turnstile.py | ||
raw_games.py | ||
raw_gui_click.py | ||
raw_hobbit.py | ||
raw_login_context.py | ||
raw_login_driver.py | ||
raw_login_sb.py | ||
raw_main_call.py | ||
raw_mobile.py | ||
raw_multi_drivers.py | ||
raw_nopecha.py | ||
raw_order_tickets.py | ||
raw_parameter_script.py | ||
raw_performance_logs.py | ||
raw_pixelscan.py | ||
raw_pyautogui.py | ||
raw_recaptcha.py | ||
raw_robot.py | ||
raw_sb.py | ||
raw_test_scripts.py | ||
raw_turnstile.py | ||
raw_uc_mode.py | ||
sb_fixture_tests.py | ||
setup.cfg | ||
shadow_root_test.py | ||
swag_labs_user_tests.py | ||
test_3d_apis.py | ||
test_apple_site.py | ||
test_assert_elements.py | ||
test_calculator.py | ||
test_canvas.py | ||
test_cdp_ad_blocking.py | ||
test_checkboxes.py | ||
test_chinese_pdf.py | ||
test_chromedriver.py | ||
test_coffee_cart.py | ||
test_console_logging.py | ||
test_contains_selector.py | ||
test_cycle_elements.py | ||
test_decryption.py | ||
test_deferred_asserts.py | ||
test_demo_site.py | ||
test_detect_404s.py | ||
test_docs_site.py | ||
test_double_click.py | ||
test_download_files.py | ||
test_download_images.py | ||
test_drag_and_drop.py | ||
test_error_page.py | ||
test_event_firing.py | ||
test_fail.py | ||
test_geolocation.py | ||
test_get_coffee.py | ||
test_get_locale_code.py | ||
test_get_pdf_text.py | ||
test_get_user_agent.py | ||
test_hack_search.py | ||
test_highlight_elements.py | ||
test_image_saving.py | ||
test_inspect_html.py | ||
test_login.py | ||
test_markers.py | ||
test_mfa_login.py | ||
test_multiple_drivers.py | ||
test_null.py | ||
test_override_driver.py | ||
test_override_sb_fixture.py | ||
test_parse_soup.py | ||
test_pdf_asserts.py | ||
test_pytest_parametrize.py | ||
test_repeat_tests.py | ||
test_request_sb_fixture.py | ||
test_save_screenshots.py | ||
test_sb_fixture.py | ||
test_scrape_bing.py | ||
test_select_options.py | ||
test_shadow_dom.py | ||
test_show_file_choosers.py | ||
test_simple_login.py | ||
test_skype_site.py | ||
test_suite.py | ||
test_swag_labs.py | ||
test_tinymce.py | ||
test_todomvc.py | ||
test_url_asserts.py | ||
test_usefixtures.py | ||
test_verify_chromedriver.py | ||
test_window_switching.py | ||
test_xfail.py | ||
test_xkcd.py | ||
time_limit_test.py | ||
uc_cdp_events.py | ||
upgrade_chromedriver.py | ||
upload_file_test.py | ||
user_agent_test.py | ||
verify_undetected.py | ||
wordle_test.py | ||
xpath_test.py | ||
youtube_search_test.py |
ReadMe.md
Example Tests:
- SeleniumBase tests are run with pytest.
- Chrome is the default browser if not specified.
- Tests are structured using 23 unique syntax formats.
- Logs from test failures are saved to
./latest_logs/
. - Tests can be run with multiple command-line options.
- Examples can be found in: SeleniumBase/examples/.
(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
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!
Ask questions. Find answers. Learn how to automate!