
SeleniumBase
Python browser testing framework with stealth and pytest built in.
Replaces Browserstack, Lambdatest, Sauce Labs, Cypress

Who it's for
Teams with existing Selenium tests can migrate incrementally. SeleniumBase supports raw `self.driver` access alongside its higher-level methods, so you can modernize test files one at a time without rewriting everything.
Your team uses Playwright or Cypress and has no Python constraint.
CDP Mode and UC Mode handle Cloudflare Turnstile and similar bot-detection protections that block standard WebDriver. Use SeleniumBase when your scraping target actively blocks automated browsers.
Your target sites have no bot-protection and static HTTP fetching is sufficient.
If your project already uses Python and pytest, SeleniumBase slots directly into your CI pipeline without a separate testing toolchain. It runs in any environment where Chrome and Python are available.
Your project uses a JavaScript frontend framework with an established JS testing stack.
The problem
Raw Selenium requires significant boilerplate to work reliably. Setting up a CLI options parser, adding explicit WebDriverWait calls for every element interaction, and parsing error output on failures all add overhead before you can write reliable tests. Teams end up maintaining test infrastructure as much as writing tests themselves. Bot-detection is a separate pain point: standard WebDriver signatures get blocked by Cloudflare Turnstile challenges and similar protections on many real-world sites. Cloud testing services like BrowserStack or Sauce Labs address cross-browser device coverage, but add per-minute pricing and route test traffic through third-party servers. Teams that need stealth, Python, and local or CI execution have historically had to stitch together multiple libraries with unreliable results.
How it works
CDP Mode uses the Chrome DevTools Protocol to bypass bot-detection on Chromium-based browsers. It handles Cloudflare Turnstile challenges automatically, with `sb.solve_captcha()` as a manual fallback when challenges are not auto-resolved.
Methods like `self.type()`, `self.click()`, and `self.assert_element()` wait up to 7 seconds for elements to be visible and interactive before acting. This eliminates most explicit WebDriverWait calls that raw Selenium requires.
Tests run with pytest or behave using standard test discovery and reporting. Command-line options let you set browser, timeout, demo mode, and UC Mode without editing code. The framework also supports pynose for compatibility with older test suites.
Write tests using BaseCase class inheritance for pytest structure, the SB context manager for script-style code, or the Driver Manager for raw driver access. All three share the same underlying methods; choose the style that fits your codebase.
The built-in Recorder captures browser actions and generates test code, reducing the manual work of writing selectors. The desktop SeleniumBase Commander GUI launches test runs without the command line.
An HTML dashboard shows test pass/fail state across a run. Failing tests automatically save screenshots to `./latest_logs/`, making post-run debugging faster without custom logging code.
Features
- CDP Mode for stealth browsing
- Auto-waiting methods
- pytest, behave, and pynose integration
- Multiple syntax formats
- Recorder and test generator
- Dashboard and failure screenshots
How to install
Install SeleniumBase from PyPI using pip; add the optional Playwright package for the CDP stealth integration.
pip install seleniumbase
pip install playwrightRecommended for this setup
Strengths
- MIT license with no seat fees: SeleniumBase is MIT-licensed and installs from PyPI. There are no per-seat charges, no usage-based billing, and no account required. Teams of any size run as many tests as they need on their own infrastructure.
- Active maintenance since 2014: The repo has been in active development for over a decade, with its last push in November 2026. With 15 open issues and over 13,000 GitHub stars, it has a proven track record and a steady release cadence.
- Automatic driver and selector handling: CSS and XPath selectors are detected automatically, so you pass a selector string without specifying its type. The driver manager downloads a matching browser driver based on the installed browser version without manual setup.
Trade-offs
- Python only: SeleniumBase is a Python framework. Teams whose test suites are in JavaScript, TypeScript, or Ruby need a different tool; Cypress or Playwright are the typical choices for non-Python shops.
- No cloud device matrix: SeleniumBase runs against browsers installed on the host machine. It does not provide access to real devices, different OS versions, or cloud-hosted browser farms. Teams that need cross-device coverage still need a service like BrowserStack or Sauce Labs alongside it.
- Selenium WebDriver limitations: SeleniumBase sits on top of Selenium WebDriver, which uses the WebDriver protocol rather than native browser APIs for most operations. This can be slower than Playwright in some scenarios and subject to the same driver compatibility issues Selenium users know.
Tech stack
FAQ
Yes. SeleniumBase supports Microsoft Edge, Brave, unbranded Chromium, and Chrome-for-Testing. Select the browser with a command-line flag (`--edge`, `--brave`, `--chromium`, `--cft`) or by passing the `browser` argument to the driver. Chrome is the default. Firefox is supported through Selenium's WebDriver, but CDP and UC stealth modes require a Chromium-based browser.
UC Mode patches ChromeDriver to avoid bot-detection signatures that standard WebDriver exposes. CDP Mode uses the Chrome DevTools Protocol directly, bypassing WebDriver for the browser session. The two can be combined: `SB(uc=True)` followed by `sb.activate_cdp_mode()`. CDP Mode is the more capable stealth option; UC Mode is the simpler entry point.
Install from PyPI with `pip install seleniumbase`. Add `--upgrade` or `-U` to update an existing install. After installation, run `seleniumbase` or `sbase` in your terminal to verify it installed correctly. For development, clone the repo and run `pip install -e .` from inside it.
SeleniumBase's Stealthy Playwright Mode integrates Playwright under the CDP Mode stealth layer, so it can drive Playwright browsers with the same anti-detection approach. SeleniumBase is primarily a Selenium framework; teams that want Playwright as their primary driver should use it directly or pair it with the SeleniumBase CDP layer for stealth. Install the Playwright integration with `pip install playwright`.
Yes. SeleniumBase includes both test-mode scripts (run with pytest) and raw Python scripts (run directly with `python`). The `sb_cdp.Chrome()` context is designed for scraping and automation without a test runner. CDP Mode's stealth and automatic CAPTCHA handling make it suitable for scraping sites that block standard HTTP clients.