SeleniumBase/examples
Michael Mintz 914b518821 Update the docs 2018-07-25 01:49:58 -04:00
..
boilerplates Update example tests 2018-07-25 00:58:56 -04:00
example_logs Update ReadMe 2017-10-26 14:01:49 -04:00
master_qa Moving masterqa examples to own folder. 2018-03-03 18:59:27 -05:00
tour_examples Update the docs 2018-07-25 01:49:58 -04:00
ReadMe.md Update ReadMe files 2018-07-03 18:56:43 -04:00
__init__.py Fresh Copy 2015-12-04 16:11:53 -05:00
basic_script.py Update example tests 2018-07-25 00:58:56 -04:00
delayed_assert_test.py Update "delayed asserts" examples 2018-03-04 10:27:41 -05:00
example_config.cfg Update example config files 2018-03-05 17:33:07 -05:00
github_test.py Don't trigger GitHub's automation-detection system 2018-04-17 03:08:28 -04:00
gui_test_runner.py Update the GUI_test_runner 2018-03-04 17:53:52 -05:00
my_first_test.py Update example tests 2018-07-25 00:58:56 -04:00
my_test_suite.py Python 3 compatibility ("xrange" becomes "range") 2017-07-19 18:38:55 -04:00
proxy_test.py Update proxy_test 2018-06-17 14:42:12 -04:00
rate_limiting_test.py Make it easier to import SeleniumBase decorators 2018-03-03 19:09:18 -05:00
run_my_first_test_in_chrome.sh Update example tests. 2018-02-08 15:17:31 -05:00
run_my_first_test_in_firefox.sh Update example tests. 2018-02-08 15:17:31 -05:00
run_rate_limiting_test.sh Update the rate-limiting example test 2016-01-11 20:15:38 -05:00
run_test_fail_with_logging.sh Update example tests. 2018-02-08 15:17:31 -05:00
setup.cfg Python 3 compatibility (remove semicolons from .cfg files) 2017-07-19 18:41:59 -04:00
test_fail.py Update test that fails on purpose. 2018-03-04 14:58:57 -05:00

ReadMe.md

Running SeleniumBase Scripts

(NOTE: If you didn't install SeleniumBase properly, these scripts won't work. Installation steps include pip install seleniumbase OR pip install -r requirements.txt + python setup.py develop" from the top-level directory.)

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: With the exception of my_first_test.py, which should pass, many other tests in this folder fail on purpose to demonstrate features such as screenshots on failure, exception logging, and test reports.)

(NOTE: You can interchange pytest with nosetests in most of these examples.)

When you run tests, youll see two folders appear: “latest_logs” and “archived_logs”. The “latest_logs” folder will contain log files from the most recent test run, but logs will only be created if the test run is failing. Afterwards, logs from the “latest_logs” folder will get pushed to the “archived_logs” folder if you have have the ARCHIVE_EXISTING_LOGS feature enabled in settings.py.

For running scripts the usual way, here are some of the example run commands:

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 (runs slower and adds highlights):

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

Run the example test suite in Chrome and generate an html report: (nosetests-only)

nosetests my_test_suite.py --browser=chrome --report --show_report

Run the example test suite in Firefox and generate an html report: (nosetests-only)

nosetests my_test_suite.py --browser=firefox --report --show_report

Run a test with configuration specifed by a config file:

nosetests my_first_test.py --config=example_config.cfg

Run a test demonstrating the use of Python decorators available:

pytest rate_limiting_test.py

Run a failing test with pdb mode enabled: (If a test failure occurs, test enters pdb mode)

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

Run a failing test (and then look into the latest_logs folder afterwards:

pytest test_fail.py --browser=chrome

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

(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.)