/playwright-bot-bypass:playwright-bot-bypassfrom playwright-bot-bypass
Reduces bot detection in Playwright automation using patchright + headed Chrome or Moli CDP. Passes fingerprint checkers and avoids CAPTCHAs on Google.
Ships in playwright-bot-bypass. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Reduce bot detection using patchright + real headed Chrome, or connect to a Moli CDP server. Passes fingerprint checkers (bot.sannysoft.com, areyouheadless) and avoids triggering CAPTCHAs on Google. Not a guaranteed bypass for CDP/runtime-aware enterprise bot managers — see "Detection Coverage" for measured results.
Authorized use only. This is for QA, accessibility testing, and research on sites you own or are permitted to test. Respect each site's Terms of Service,
robots.txt, and applicable law. Do not use it to bypass paywalls, abuse rate limits, or scrape against a site's stated wishes.
Evasion comes from three layers, not one — most of it is the real browser, not hand-written JS:
| Detection Point | Standard Playwright (headless) | Defeated by |
|---|---|---|
CDP / Runtime.enable leak | Present (headless tell) | patchright (baked into the driver) |
window.__pwInitScripts (isPlaywright) | Present | artifact strip (init script deletes it every nav) |
navigator.webdriver | true | patchright (reports false; we do NOT delete it — undefined is itself a tell) |
| WebGL Renderer | SwiftShader (software) | channel:'chrome' + headed mode (real GPU) |
| User Agent | Contains "HeadlessChrome" | channel:'chrome' (real Chrome UA) — no JS override |
| Canvas fingerprint | Software-rendered tell | headed real Chrome (genuine GPU canvas) — no JS noise |
navigator.plugins | Empty array | headed real Chrome (genuine PluginArray) — no JS fake |
navigator.languages | ['en-US'] only | locale option (native, worker-consistent — no JS getter) |
Why so little hand-written JS? Across v2.1/v2.2 the old fake-PluginArray, canvas-noise, hardcoded-
hardwareConcurrency, permissions-override,webdriverdelete, andnavigator.languagesgetter were all removed — every one created a detectable inconsistency (own-property tells, worker mismatches,undefinedwebdriver, anIllegal invocationcrash). v2.3 keeps exactly two active measures on the Chrome engine: strip Playwright's__pwInitScriptsartifact, and rely on patchright's baked-in Runtime-fix. Everything else is the genuine, self-consistent real browser. Less faking = more consistent = harder to detect.
.mjs files)headless: false) — no display = no stealthVerify Chrome is installed:
# macOS
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version
# Windows
"C:\Program Files\Google\Chrome\Application\chrome.exe" --version
# Linux
google-chrome --version
npm init -y && npm install patchright
stealth-test.mjsimport os from 'node:os';
import path from 'node:path';
// patchright patches are baked in — no env setup needed.
const { chromium } = await import('patchright');
const browser = await chromium.launch({
headless: false, // headed = real GPU/canvas
channel: 'chrome', // real Chrome = real UA/WebGL/plugins
args: ['--disable-blink-features=AutomationControlled']
});
// `locale` sets navigator.languages + Accept-Language natively & consistently.
const context = await browser.newContext({ locale: 'ko-KR' });
// The ONLY init script: strip Playwright's main-world signature. Touch NOTHING
// on navigator — the real browser's values are already genuine & consistent.
await context.addInitScript(() => {
for (const k of Object.getOwnPropertyNames(window)) {
if (/^__pw|pwInitScripts|playwright/i.test(k)) {
try { delete window[k]; } catch {}
}
}
if (!window.chrome) window.chrome = {};
});
const page = await context.newPage();
try {
await page.goto('https://bot.sannysoft.com', { waitUntil: 'networkidle' });
const out = path.join(os.tmpdir(), 'stealth-test.png');
await page.screenshot({ path: out });
console.log(`Screenshot saved: ${out}`);
} finally {
await browser.close();
}
node stealth-test.mjs
The scripts/stealth-template.mjs provides a reusable factory with all patches pre-applied:
import { createStealthBrowser, humanDelay, humanType, simulateMouseMovement } from './scripts/stealth-template.mjs';
const { browser, page } = await createStealthBrowser();
try {
await page.goto('https://example.com');
// Human-like mouse movement (avoids Cloudflare Turnstile)
await simulateMouseMovement(page);
// Human-like typing instead of instant fill
await humanType(page, 'input[name="q"]', 'search query');
await humanDelay(300, 800);
} finally {
await browser.close();
}
const { browser, context, page } = await createStealthBrowser({
headless: false, // Required for stealth (default)
viewport: { width: 1280, height: 800 }, // Default
locale: 'ko-KR', // Browser locale (default)
userAgent: null, // Custom UA (optional; default = real Chrome UA)
storageState: './session.json', // Cookie persistence (optional)
proxy: { server: 'http://proxy:8080' }, // Proxy (optional)
noSandbox: false // Opt-in --no-sandbox (Linux root/CI only; it's a bot signal)
});
// Save session for reuse
import { saveSession } from './scripts/stealth-template.mjs';
await saveSession(context, './session.json');
The template (v2.2) keeps the active surface to exactly two measures:
| Measure | Why |
|---|---|
Strip window.__pwInitScripts / __playwright* (init script, every nav) | Removes the deterministic isPlaywright signature detectors key on |
| patchright's baked-in Runtime-fix (no env var, no init script) | Hides the CDP Runtime.enable headless leak |
It touches nothing on navigator. Everything else is delegated to the real browser (channel:'chrome' + headed): genuine User-Agent, WebGL/GPU renderer, canvas fingerprint, PluginArray, self-consistent permission/hardware values, and (via the locale option) native worker-consistent navigator.languages + Accept-Language.
Removed across v2.1/v2.2 (each was net-negative — faked values inconsistently with the real environment): fake navigator.plugins, canvas getImageData noise, hardcoded hardwareConcurrency/deviceMemory, outerWidth/Height offset, the permissions override (crashed with Illegal invocation), the navigator.webdriver delete (made it undefined — a tell), and the navigator.languages getter (own-property + worker-mismatch tells).
Launch arg: --disable-blink-features=AutomationControlled. --no-sandbox is opt-in ({ noSandbox: true }) — it is both a security risk and an automation signal, so it is off by default.
patchright may print non-fatal world-access warnings on heavy SPAs — the page still loads.
scripts/stealth-template.mjs — Reusable stealth browser factory (all examples import this)scripts/bot-detection-test.mjs — Verify bypass at bot.sannysoft.comexamples/stealth-google-search.mjs — Google search without CAPTCHAexamples/ab-test.mjs — Side-by-side detected vs stealth comparisonexamples/stealth-twitter-scrape.mjs — Twitter/X profile scrapingNote:
ab-test.mjsrequires bothpatchrightANDplaywright:npm install patchright playwright && npx playwright install chromium
All screenshots are saved to the OS temp directory (os.tmpdir()) — /tmp on macOS/Linux, %TEMP% on Windows.
Honest, tested results.
Measured 2026-11-30 on the default Chrome engine (macOS, Apple M2; patchright 1.64.3 + Chrome 158). sannysoft via scripts/bot-detection-test.mjs, the rest by visiting each detector in a stealth page and reading its verdict.
| Detector | Result |
|---|---|
| bot.sannysoft.com | ✅ all 6 colored rows pass; navigator.webdriver false; real Apple M2 WebGL |
| hmaker.github.io/selenium-detector | ✅ "Passing" |
| deviceandbrowserinfo.com/are_you_a_bot | ✅ "You are human!" (isBot:false, isPlaywright:false, isAutomatedWithCDP:false) |
| browserscan.net/bot-detection | ✅ "Normal" |
| creepjs | ✅ 0% headless / 0% stealth (fuzzy "38% like headless" is not a detection) |
| iphey.com | ✅ "Trustworthy" |
| bot-detector.rebrowser.net | ⚠️ 2 red: documentInterception, storagePartitioning — see note below |
| arh.antoinevastel.com/bots/areyouheadless | ⚠️ site returned HTTP 502 today (could not verify) |
| nowsecure.nl (Cloudflare Turnstile) | ⚠️ interactive Turnstile challenge shown — behavioral/IP gate, not a fingerprint check; not auto-passed |
So 6 fingerprint detectors pass today; rebrowser.net trips 2 red, Turnstile is a behavioral gate (not auto-passed), and areyouheadless was unreachable.
Regression introduced by the patchright swap:
bot-detector.rebrowser.netnow flagsdocumentInterception("This page arrived with no network protocol although data was transferred … Patchright does this on everyexposeFunction") andstoragePartitioning. The earlier rebrowser-playwright build was reported as 0 red. These two reds are real today; the "0 red" claim no longer holds.
Two levers:
createStealthBrowser() deletes window.__pwInitScripts / __playwright* (the deterministic isPlaywright signature) on every navigation.Runtime.enable leak at the driver level, no env var needed.The residual leak: window.__playwright_builtins__ is a separate, non-configurable Playwright global that cannot be deleted or redefined. None of the detectors above key on it today, but a future detector could. patchright (1.64.3) does not remove it either — tracked upstream in rebrowser-patches#110, open with no fix.
Takeaway: passes the fingerprint suites (sannysoft, deviceandbrowserinfo, browserscan, creepjs), but not every automation-framework probe — patchright trips
documentInterceptionandstoragePartitioningon rebrowser.net. Still not a guaranteed bypass for behavioral/IP systems (Cloudflare Turnstile, DataDome, Kasada) or login walls. For those, add residential IPs + real interaction, or switch to nodriver (structurally avoids the whole CDP/automation-protocol class).
One load each on a residential IP. 🟢 content loaded, 🟡 content behind the standard logged-out login modal (not a bot block), 🔴 bot/CAPTCHA wall.
| Site | Result |
|---|---|
| X / Twitter (profile) | 🟢 profile + tweets loaded |
| YouTube | 🟢 loaded |
| TikTok (profile) | 🟢 loaded |
| Google search | 🟢 results, no CAPTCHA |
| 🔴 "Prove your humanity" reCAPTCHA this run | |
| Instagram / Facebook / LinkedIn | 🟡 content behind the standard logged-out login modal |
Key result: most public pages loaded; the examples stealth-google-search.mjs reported "no CAPTCHA" and stealth-twitter-scrape.mjs loaded the @github profile with tweets. CAPTCHA-prone sites (Google, Reddit) are IP/behavioral gates that vary run to run — Reddit showed a humanity challenge on this run. Caveat: one load each; at volume IG/FB/LinkedIn enforce datr-cookie aging, HTTP 999 and rate limits, which this skill does not address.
headless: false (headed mode with display)channel: 'chrome')humanDelay, humanType, simulateMouseMovementchannel: 'chrome' (uses real Chrome binary)__playwright_builtins__ leak (see Detection Coverage) is unfixable at the skill level — it's inherent to patchright 1.64.3pip install undetected-chromedriver
import undetected_chromedriver as uc
# Match your Chrome version: check chrome://version
driver = uc.Chrome() # auto-detects version
driver.get("https://www.google.com")
search_box = driver.find_element("name", "q")
search_box.send_keys("your search query")
search_box.submit()
Python
playwright-stealthonly patches at JS level — WebGL still shows SwiftShader. Useundetected-chromedriverinstead.
import subprocess
result = subprocess.run(['node', 'stealth-script.mjs', query], capture_output=True)
| Problem | Fix |
|---|---|
ERR_MODULE_NOT_FOUND | Run npm install patchright in the same directory as your script |
| Browser not opening | Verify Chrome is installed (see Prerequisites) |
| WebGL shows SwiftShader | You're effectively headless / GPU-less. Run headed (headless: false) with channel: 'chrome' on a machine with a real GPU; SwiftShader is the software fallback, not an import issue |
| Still getting detected | Add simulateMouseMovement() and humanDelay() between actions |
| Process hangs | Ensure browser.close() is in a finally block |
SyntaxError: await | File must be .mjs or have "type": "module" in package.json |
examples/ab-test.mjs (opens in a new tab)examples/stealth-google-search.mjs (opens in a new tab)examples/stealth-twitter-scrape.mjs (opens in a new tab)package-lock.json (opens in a new tab)package.json (opens in a new tab)scripts/bot-detection-test.mjs (opens in a new tab)scripts/stealth-template.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub greekr4/playwright-bot-bypass --plugin playwright-bot-bypassOther plugins' skills for the same job