█

AI/TLDR

Buy me a coffee
Buy me a coffee

SeleniumBase

All-in-one Python browser automation for testing, scraping, and stealth crawling

Web Scraping & CrawlingOpen source
Language
Python
License
MIT
$pip install seleniumbase
IN SHORT

What is SeleniumBase?

SeleniumBase is an open-source Python framework that brings web testing, web crawling, scraping, and stealth automation together in one tool. You write Python scripts that drive a real Chromium browser, and the framework handles the setup, waiting, and driver management for you. It sits in the Web Scraping & Crawling category of the Data & Labeling tools and is open-source, written in Python and licensed MIT.

Overview

SeleniumBase is an open-source Python framework that brings web testing, web crawling, scraping, and stealth automation together in one tool. You write Python scripts that drive a real Chromium browser, and the framework handles the setup, waiting, and driver management for you.

It runs on top of Selenium WebDriver and adds higher-level methods so your code stays short and readable. Most scripts can be run with pytest, pynose, or plain python, and a stealthy CDP Mode lets your browser sessions pass common bot-detection tests on sites that block normal automation.

What it does

  • CDP Mode: a stealthy Chromium automation mode that bypasses common bot-detection systems
  • Stealthy Playwright Mode that connects Playwright to a SeleniumBase browser session
  • High-level Python methods (open, find_elements, assert_element, and more) that reduce boilerplate over raw Selenium
  • Runs the same tests with pytest, pynose, or pure python, plus a Gherkin/behave BDD format
  • Command-line tools via the seleniumbase / sbase commands, including project scaffolding with sbase mkdir
  • Test reporting extras like HTML reports, a dashboard, screenshots, and a demo mode for visual stepping

Getting started

SeleniumBase installs from PyPI with pip. Install the package, verify the command-line tool, then run a script with pytest or pure Python.

Install SeleniumBase

Install the main framework from PyPI. Add Playwright too if you want the Stealthy Playwright integration.

bashbash
pip install seleniumbase
pip install playwright

Verify the install

Type seleniumbase or sbase to confirm the framework installed correctly and to see the available commands.

bashbash
sbase --help

Run a stealthy CDP Mode script

Pure CDP Mode (sb_cdp) opens a stealthy Chromium browser. This short script navigates to a bot-detection page and then quits.

pythonpython
from seleniumbase import sb_cdp

sb = sb_cdp.Chrome()
sb.goto("https://browserscan.net/bot-detection")
sb.sleep(3)
sb.quit()

Run a test with pytest

Tests built on the BaseCase class run through pytest. Use the --demo flag to step through the actions visually.

bashbash
pytest my_first_test.py --demo

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Write end-to-end UI tests for web apps and run them with pytest, with HTML reports and a dashboard
  • Scrape data from pages, such as collecting listing titles and links into a Python list
  • Crawl sites protected by bot-detection using the stealthy CDP Mode browser
  • Connect Playwright to a stealthy SeleniumBase session for automation that needs to look like a real user

How SeleniumBase compares

SeleniumBase alongside other open-source web scraping & crawling tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Firecrawl★ 214kA crawling service and API that converts whole websites into clean Markdown or structured JSON ready for LLMs.
Agent Reach★ 116kA capability layer that installs, health-checks and routes readers so a CLI agent can read and search web pages, YouTube, RSS, GitHub, Reddit, Twitter/X and more without API fees.
Scrapling★ 107kA Python web scraping framework whose parser relocates your elements when pages change, with stealthy fetchers and a Scrapy-like spider engine for full crawls.
Crawl4AI★ 88.2kA local-first Python web crawler that turns pages into clean Markdown for use in RAG and LLM pipelines.
Scrapy★ 65.7kA mature Python framework for writing fast spiders that crawl websites and extract structured data at scale.
changedetection.io★ 36.1kA self-hosted web page change monitor with XPath/CSS/jq filters, browser steps and restock alerts, which can route every diff through an LLM to suppress noise.
ScrapeGraphAI★ 33kA Python library that uses LLMs and a graph pipeline to extract data from pages based on natural-language prompts.
SeleniumBase★ 13.3kAll-in-one Python browser automation for testing, scraping, and stealth crawling