SeleniumBase/examples
Michael Mintz 9398bb087e Update test row to match quote format of other rows 2019-04-22 09:57:41 -04:00
..
boilerplates Use the new assert_true() format instead of assertTrue() 2019-02-06 01:45:10 -05:00
capabilities Allow passing a boolean value to desired capabilities 2019-04-04 10:19:21 -04:00
example_logs Update example tests 2018-12-11 02:01:57 -05:00
master_qa Update MasterQA example tests 2018-11-02 19:17:48 -04:00
tour_examples Update the docs 2019-04-14 05:05:21 -04:00
visual_testing Update the Automated Visual Testing ReadMe 2019-04-17 01:12:43 -04:00
ReadMe.md Update example tests 2018-12-11 02:01:57 -05:00
__init__.py Fresh Copy 2015-12-04 16:11:53 -05:00
basic_test.py Update a test 2019-04-18 03:51:33 -04:00
delayed_assert_test.py Update example tests 2018-12-11 02:01:57 -05:00
example_config.cfg Update example config files 2018-03-05 17:33:07 -05:00
get_ip_with_bing.py Rename an example test 2019-02-06 01:42:58 -05:00
github_test.py Update a test 2019-03-16 01:49:11 -04:00
gui_test_runner.py Update example tests 2018-12-11 02:01:57 -05:00
image_test.py Add image test to save an element screenshot to a file 2019-04-06 01:21:03 -04:00
ip_cow_test.py Add the ip_cow test 2019-03-17 02:09:30 -04:00
my_first_test.py Update example tests 2019-02-15 02:30:36 -05:00
parameterized_test.py Adding parameterized example test 2018-08-27 22:20:09 -04:00
proxy_test.py Update proxy test 2018-10-17 18:19:38 -04:00
rate_limiting_test.py Make it easier to import SeleniumBase decorators 2018-03-03 19:09:18 -05:00
raw_parameter_script.py Update raw_parameter_script 2019-04-14 05:03:06 -04:00
setup.cfg Python 3 compatibility (remove semicolons from .cfg files) 2017-07-19 18:41:59 -04:00
swag_labs_suite.py Update test row to match quote format of other rows 2019-04-22 09:57:41 -04:00
test_fail.py Update example tests 2018-12-11 02:01:57 -05:00
test_markers.py Add test suite for demoing pytest markers 2018-12-11 02:04:13 -05:00
test_suite.py Update example tests 2018-12-11 02:01:57 -05:00
user_agent_test.py Update the user agent test 2019-03-17 02:05:07 -04:00

ReadMe.md

Running SeleniumBase Scripts

To run tests, make sure you've already installed SeleniumBase using pip install seleniumbase OR pip install -r requirements.txt + python setup.py install from the top-level directory.

You can interchange pytest with nosetests, but using pytest is strongly recommended because developers stopped supporting nosetests. Chrome is the default browser if not specified.

During test failures, logs and screenshots from the most recent test run will get saved to the latest_logs/ folder. Those logs will get moved to archived_logs/ if you have ARCHIVE_EXISTING_LOGS set to True in settings.py

(NOTE: Many tests in this folder fail on purpose to demonstrate the built-in logging, screenshots, and reporting features.)

Here are some example run commands to help get you started:

Run the example test in Chrome:

pytest my_first_test.py --browser=chrome

Run the example test in Firefox:

pytest my_first_test.py --browser=firefox

Run the example test in Demo Mode (highlights page objects being acted on):

pytest my_first_test.py --browser=chrome --demo_mode

Run the example test suite and generate an pytest report: (pytest-only)

pytest test_suite.py --html=report.html

Run the example test suite and generate a nosetest report: (nosetests-only)

nosetests test_suite.py --report --show_report

Run a test using a nosetest configuration file: (nosetests-only)

nosetests my_first_test.py --config=example_config.cfg

Run a test demonstrating the use of SeleniumBase Python decorators available:

pytest rate_limiting_test.py

Run a failing test: (See the latest_logs/ folder afterwards for logs and screenshots)

pytest test_fail.py --browser=chrome

Run a failing test with Debugging-mode enabled: (If a test failure occurs, pdb activates)

pytest test_fail.py --browser=chrome --pdb -s

For more advanced run commands, such as using a proxy server, see ../help_docs/customizing_test_runs.md


To makes things easier, here's a simple GUI program that allows you to kick off a few example scripts by pressing a button:

python gui_test_runner.py

(NOTE: If you see any *.pyc files appear as you run tests, that's perfectly normal. Compiled bytecode is a natural result of running Python code.)