Skip to content

Migrating from playwright-stealth or Patchright

You already write Playwright, so this is the shortest move: the SDK's launch() returns a Playwright Browser. Replace the line that launches the browser, and every line after it stays.

From playwright-stealth

from playwright.sync_api import sync_playwright
from playwright_stealth import stealth_sync
from clearcote import launch

browser = sync_playwright().start().chromium.launch(proxy={"server": "http://proxy.example:8080"})
page = browser.new_page(user_agent="Mozilla/5.0 ...", locale="de-DE", timezone_id="Europe/Berlin")
stealth_sync(page)
browser = launch(
    fingerprint="acct-1",                    # one seed per account: the same device every run
    proxy={"server": "http://proxy.example:8080"},
    geoip=True,                              # timezone, language and WebRTC follow the exit IP
)
page = browser.new_page()
page.goto("https://example.com")
browser.close()

On playwright-stealth 2.x, the Stealth().use_sync(sync_playwright()) block goes the same way. launch() starts Playwright itself, takes Playwright's own launch options (headless, proxy, args, slow_mo) next to Clearcote's, and downloads a verified build to its cache on first use.

From Patchright

from patchright.sync_api import sync_playwright
from clearcote import launch_persistent_context

context = sync_playwright().start().chromium.launch_persistent_context(
    user_data_dir="profiles/acct-1", channel="chrome", headless=False, no_viewport=True,
)
context = launch_persistent_context("profiles/acct-1", fingerprint="acct-1", headless=False)
page = context.new_page()
page.goto("https://example.com")
context.close()

The SDK already turns off Playwright's emulated viewport and the --enable-automation switch, so no_viewport and channel go. To keep Patchright's driver anyway, start Clearcote with serve() and connect Patchright with connect_over_cdp(srv.cdp_url); see Puppeteer and other CDP clients.

What else to remove

You setWith Clearcote
add_init_script evasionsRemove them. The engine sets these values natively
user_agent=, viewport=, device_scale_factor=Remove them. They come from the persona and agree with the screen, the GPU and Client Hints
locale=, timezone_id=geoip=True with a proxy, or accept_language and timezone on launch()
a random user agent per runA fingerprint seed per account. A new seed is a new, coherent device
your own mouse-movement helpershumanize=True: human paths, typing and scrolling in Playwright's own calls

browser.new_context(...) still works, but its options override the persona. Leave them out, or use browser.new_page(), which opens a page with the persona as it is.

Check the switch

clearcote info prints the build the SDK resolves and a launch test. Without a licence key that is the open build (BSD-3, no account); a proxy with a username and password needs the latest build, free with a GitHub sign-in (clearcote login). Next: Recommended settings and Humanized input. Comparisons: playwright-stealth and Patchright.