Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
S

SeleniumBase

> 测试质量
Open source

APIs for web automation, testing, and bypassing bot-detection.

12.9K stars0 likes9 views
WebsiteGitHub

About

APIs for web automation, testing, and bypassing bot-detection.

All-in-one Browser Automation Framework:
Web Crawling / Testing / Scraping / Stealth

Start | Features | ️ Options | Examples | Scripts | Locale
API | Stealth API | DesignPatterns | Recorder | Dashboard
️ GUI | TestPage | UC Mode | CDP Mode | Charts | ️ Farm
️ How | Migration | Stealthy Playwright | MasterQA | Tours
MCP | JS Mgr | Translator | ️ Presenter | ️ Visual | ️ CPlans


  • CDP Mode bypasses bot-detection with Chromium-based browsers.
  • Stealthy Playwright Mode extends CDP Mode's stealth to Playwright.
  • pip install seleniumbase for the main framework. (Or use uv add)
  • pip install playwright for the optional integration. (Or use uv add)
  • For the seleniumbase-mcp MCP server, see the MCP ReadMe.

Here's a Python example that uses Pure CDP Mode (sb_cdp):
(It navigates to Browserscan where it bypasses bot-detection.)

python
from seleniumbase import sb_cdp

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


(All BrowserScan bot-detection tests passed successfully.)

Here's an example script that uses Stealthy Playwright Mode:
(Playwright connects to a stealthy SeleniumBase browser session.)

python
from playwright.sync_api import sync_playwright
from seleniumbase import sb_cdp

sb = sb_cdp.Chrome(guest=True)
endpoint_url = sb.get_endpoint_url()

with sync_playwright() as p:
    browser = p.chromium.connect_over_cdp(endpoint_url)
    page = browser.contexts[0].pages[0]
    page.goto("https://bot.sannysoft.com/")
    page.wait_for_timeout(500)


(All Sannysoft bot-detection tests passed successfully.)


This example shows off multiple methods:

python
from seleniumbase import sb_cdp

sb = sb_cdp.Chrome()
sb.goto("https://seleniumbase.io/demo_page")
sb.type("input", "Quickly type text!")
sb.press_keys("textarea", "Slowly type text!")
sb.click("#myButton")
sb.set_value("input#mySlider", "100")
sb.click_visible_elements("input.checkBoxClassB")
sb.select_option_by_text("#mySelect", "Set to 75%")
sb.hover_and_click("#myDropdown", "#dropOption2")
sb.click("#checkBox1")
sb.drag_and_drop("img#logo", "div#drop2")
sb.nested_click("iframe#myFrame3", ".fBox")
sb.highlight("#myButton")
sb.quit()

This example expands the Browserscan script into a test demo:
(Assertions added and elements highlighted with JavaScript.)

python
from seleniumbase import sb_cdp

sb = sb_cdp.Chrome(locale="en", ad_block=True)
sb.goto("https://browserscan.net/bot-detection")
sb.flash("Test Results", duration=1.5, pause=0.5)
sb.assert_element('strong:contains("Normal")')
print("Bot Not Detected")
sb.flash('strong:contains("Normal")', pause=1)
sb.quit()

This example scrapes Hacker News listings:

python
from seleniumbase import sb_cdp

sb = sb_cdp.Chrome()
sb.goto("https://news.ycombinator.com/submitted?id=seleniumbase")
elements = sb.find_elements("span.titleline > a")
for element in elements:
    print("* " + element.text)

Stealthy CDP Mode examples are located in ./examples/cdp_mode/.

Stealthy Playwright examples are located in ./examples/cdp_mode/playwright/.


⚙️ Stealthy architecture flowchart:


(For maximum stealth, use CDP Mode, which includes Stealthy Playwright Mode.)


CLI Options for Supported Chromium Browsers

You can set the Chromium browser to use via command line parameters:

bash
python SCRIPT.py --chromium  # Use the unbranded Chromium browser
python SCRIPT.py --cft  # Use Chrome-for-testing
python SCRIPT.py --edge  # Use Microsoft Edge
python SCRIPT.py --brave  # Use Brave browser

Google Chrome is the default browser. Only unbranded Chromium and Chrome-for-Testing get downloaded automatically if not already present on the system.

The Chromium browser can also be set via method args, eg: cft=True, use_chromium=True, browser="edge", browser="brave", etc. Eg:

python
sb = sb_cdp.Chrome(use_chromium=True)

This example saves Google Search results with UC + CDP Mode:
(Results are saved as PDF, HTML, and PNG files to ./latest_logs/)

python
from seleniumbase import SB

with SB(uc=True, test=True) as sb:
    url = "https://google.com/ncr"
    sb.activate_cdp_mode(url)
    sb.click_if_visible('button:contains("Accept all")')
    sb.type('[name="q"]', "SeleniumBase GitHub page")
    sb.click('[value="Google Search"]')
    sb.sleep(4)  # The "AI Overview" sometimes loads
    print(sb.get_page_title())
    sb.save_as_pdf_to_logs()
    sb.save_page_source_to_logs()
    sb.save_screenshot_to_logs()
    print("Logs have been saved to: ./latest_logs/")

This example bypasses Cloudflare's challenge page with UC + CDP Mode:
(If the Turnstile isn't bypassed automatically, sb.solve_captcha() handles it.)

python
from seleniumbase import SB

with SB(uc=True, test=True, locale="en") as sb:
    url = "https://gitlab.com/users/sign_in"
    sb.activate_cdp_mode(url)
    sb.sleep(2)
    sb.solve_captcha()
    # (The rest is for testing and demo purposes)
    sb.assert_text("Username", '[for="user_login"]', timeout=3)
    sb.assert_element('label[for="user_login"]')
    sb.highlight('button:contains("Sign in")')
    sb.highlight('h1:contains("GitLab")')
    sb.post_message("SeleniumBase wasn't detected", duration=4)


(Successfully bypassed bot-detection on a Cloudflare challenge page.)

sb.solve_captch

Issues· 14 open

View all issuesOpen on GitHub
  • #4469

    MCP Server Support

    enhancementrequirementsdocumentationUC Mode / CDP ModeMCPUpdated Sep 9, 2026
  • #4240

    Web-scraping TikTok from GitHub Actions

    documentationUC Mode / CDP ModeUpdated Aug 10, 2026
  • #4421

    Stealth Showcase: Bypassing DataDome in GitHub Actions to scrape Etsy listings

    News / AnnouncementsUC Mode / CDP ModeUpdated Jul 8, 2026
  • #4247

    High-Level Stealthy Architecture Overview

    documentationUC Mode / CDP ModeUpdated Jun 14, 2026
  • #3247

    Documenting the `selenium-wire` "Wire Mode" REPLACEMENT

    enhancementdocumentationUC Mode / CDP ModeUpdated Jun 12, 2026
  • #4344

    "Undetectable Automation: 5th Edition" is now on YouTube

    News / AnnouncementsTutorials & LearningUC Mode / CDP ModeUpdated Jun 9, 2026
  • #4266

    Task: Update list of businesses using SeleniumBase

    documentationUpdated Mar 6, 2026
  • #4253

    "Stealthy Docker Browser Automation" is now on YouTube

    News / AnnouncementsTutorials & LearningUC Mode / CDP ModeUpdated Feb 21, 2026
  • #4185

    "Stealthy Playwright Mode: Bypass CAPTCHAs and Bot-Detection!" is now on YouTube

    News / AnnouncementsTutorials & LearningUC Mode / CDP ModeUpdated Feb 21, 2026
  • #4200

    "Stealthy Playwright on Linux Servers (with CAPTCHA-bypass)" is now on YouTube

    News / AnnouncementsTutorials & LearningUC Mode / CDP ModeUpdated Feb 8, 2026

> Tags

Pythonanti-detectionbot-detectionchromedriverchromium

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 28, 2026
Category测试质量
PricingOpen source

> Related tools

J
Jest
JavaScript 测试框架
P
Playwright
现代端到端测试框架
E
eslint-plugin-test-selectors
Enforces that data-test-id attributes are added to interactive DOM elements (JSX) to help with UI testing. JSX only.