How it Works

How it works:

At the core, SeleniumBase works by extending pytest as a direct plugin. SeleniumBase automatically spins up web browsers for tests (using Selenium WebDriver), and then gives those tests access to the SeleniumBase libraries through the BaseCase class. Tests are also given access to SeleniumBase command-line arguments and SeleniumBase methods, which provide additional functionality.

(NOTE: pytest uses a feature called test discovery to automatically find and run Python methods that start with "test_" from the file that you specified on the command line.)

The most common way of using SeleniumBase is by inheriting BaseCase:

from seleniumbase import BaseCase

Then have your test classes inherit BaseCase:

class MyTestClass(BaseCase):

(See the example test, my_first_test.py, for reference.)


For more ways of using SeleniumBase, see: SyntaxFormats.