The SeleniumBase Python-WebDriver framework allows you easily automate Web UI tests quickly and reliably. Here's an example of this test running against a website to test the complete flow of logging in, searching for an item, adding the item to a shopping cart, and making a purchase:
That test was run with
pytest, a Python unit-testing framework that can expand to do much more than unit-testing. The
--demo command-line option was added to activate "Demo Mode", which slows down the test and lets you see what the test assertions are. (Run from here).
pytest test_swag_labs.py --demo
Once you've created your tests, you can easily run them from GitHub Workflows. This tutorial will help you get started.
Step 0. Create a fork of SeleniumBase on GitHub to help you get started.
- (You'll be using your own repo eventually.)
- (If using a SeleniumBase fork, the script from https://github.com/seleniumbase/SeleniumBase/blob/master/.github/workflows/python-package.yml already exists to help guide you.)
- (See https://github.com/seleniumbase/SeleniumBase/actions for the SeleniumBase example.)
- (You can click inside each build for more details.)
- (You can also see the specific steps being performed by each command.)
- (You'll notice that web browsers such as Chrome and Firefox get installed for tests to use. SeleniumBase uses pytest for running tests while using Selenium WebDriver to interact with web browsers.)