SeleniumBase

4.47.9 · active · verified Thu Apr 09

SeleniumBase is a complete web automation framework for end-to-end testing, built on top of the Selenium/WebDriver APIs. It simplifies browser automation with an intuitive syntax, built-in features for reliable interactions, and advanced capabilities like bot-detection avoidance. It supports various tasks from testing to web scraping and maintains a rapid release cadence with frequent patches.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates a basic interaction with a demo page using the `SB()` context manager. It opens a URL, types text into an input field, clicks a button, asserts text presence, highlights an element, and then asserts the presence of another element. This format allows running SeleniumBase scripts without explicit pytest integration.

from seleniumbase import SB

with SB() as sb:
    sb.open("https://seleniumbase.io/demo_page")
    sb.type("#myTextInput", "This is an automated test")
    sb.click("#myButton")
    sb.assert_text("Automation Practice", "h3")
    sb.highlight("#myButton")
    sb.sleep(1)
    sb.assert_element("tbody#tbodyId")
    print("Test completed successfully!")

view raw JSON →