Playwright / Patchright
Playwright / Patchright
Connect to Chaser sessions with patchright, a drop-in Playwright replacement that patches detectable automation artifacts in Chromium.
Why patchright?
The Chromium bundled with stock Playwright ships with properties that anti-bot systems check:
navigator.webdriver === true- Missing
chrome.runtime window.chromeinconsistencies- Headless-specific user-agent tokens
Patchright patches these at the browser level. The API is identical to Playwright — same imports, same types, same methods. Swap the import and the session looks like an unmodified user browser.
Installation
Python:
Basic connection
Python
Waiting for the session to be ready
POST /v1/sessions returns immediately with status: "creating". The cdp_url is present in the response but the session may not be ready yet. Poll until status is "ready":
Handling disconnection
When the session expires or is deleted, the WebSocket closes. Listen for the disconnected event:
What not to do
- Don’t call
chromium.launch()— useconnectOverCDP - Don’t call
browser.newContext()— usebrowser.contexts()[0] - Don’t use
page.screenshot()— use the/screenshotendpoint - Don’t override the user-agent or viewport — it breaks fingerprint consistency