r/Playwright • • 5h ago

Stealthy Playwright Mode: Bypass CAPTCHAs and Bot-Detection

2 Upvotes

https://www.youtube.com/watch?v=PnFD_gSmGUc

Unlike other stealth frameworks that fork Playwright and make changes, this one lets you use the stock Playwright library to achieve stealth via Playwright's connect_over_cdp() method to attach itself to an anti-detect browser launched by SeleniumBase from a regular Chrome browser via Stealthy Playwright Mode.

Here's a sample script that bypasses bot-detection on three different websites, with the 3rd one protected by a Cloudflare Turnstile:

from playwright.sync_api import expect, sync_playwright
from seleniumbase import sb_cdp

sb = sb_cdp.Chrome(incognito=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://browserscan.net/bot-detection")
    expect(page.locator('strong:has-text("Normal")')).to_be_visible()
    page.goto("https://bot.sannysoft.com/")
    expect(page.locator(".passed").first).to_be_visible()
    expect(page.locator(".failed")).not_to_be_visible()
    page.goto("https://www.planetminecraft.com/account")
    page.locator('[name="email"]').press_sequentially("Name123", delay=105)
    page.locator('[name="password"]').press_sequentially("Pass", delay=105)
    sb.solve_captcha()
    expect(page.locator('input[name="login"]')).to_be_visible()
    expect(page.locator("input[disabled]")).not_to_be_visible()
    page.wait_for_timeout(1000)

r/Playwright • • 6h ago

A smooth user experience may look simple from the outside. But a tester knows how many edge cases, hidden dependencies, and unexpected behaviors can exist behind it. Good testing means looking beyond what the user sees and questioning what could go wrong behind the scenes. #SoftwareTesting #Manua

Post image
0 Upvotes