seleniumbase/SeleniumBase

Browser automation, web scraping, and testing. CDP Mode provides a Stealthy Chromium instance that bypasses bot-detection systems. Includes an MCP server.

What it solves

SeleniumBase is an all-in-one browser automation framework designed to simplify web crawling, scraping, and end-to-end (E2E) testing. It addresses the complexity of raw Selenium by providing a more intuitive API, integrated test runners like pytest, and advanced capabilities to bypass bot-detection systems that often block automated scripts.

How it works

It builds upon Selenium/WebDriver APIs but adds a high-level layer of convenience methods. It features several specialized modes:

  • CDP Mode: Uses the Chrome DevTools Protocol to bypass bot-detection in Chromium-based browsers.
  • UC Mode (Undetected-Chromium): Specifically designed to avoid detection by services like Cloudflare.
  • Stealthy Playwright Mode: Extends the stealth capabilities of CDP Mode to the Playwright library.

The framework automatically handles element visibility and interactivity, detects selector types (CSS vs XPath), and includes a built-in driver manager to handle browser driver versions automatically.

Who it’s for

  • QA Engineers: For creating reliable, fast, and easy E2E UI tests using pytest.
  • Web Scrapers: For extracting data from websites that employ aggressive bot-detection.
  • Automation Developers: For those needing a comprehensive toolset for Chromium automation with Python.

Highlights

  • Bot-Detection Bypass: Specialized modes (CDP and UC) to navigate sites that block automation.
  • Integrated Testing: Native support for pytest with a dedicated BaseCase class for structured testing.
  • Simplified API: Combined actions (e.g., type() handles waiting, clearing, and typing in one call).
  • CAPTCHA Solving: Includes sb.solve_captcha() to handle challenges that aren't bypassed automatically.
  • Multi-Browser Support: Compatible with Google Chrome, Chromium, Edge, and Brave.

Related

  • Project
  • Project
  • Project
  • Project