CDP Connection
How to connect to a Chaser session, what works, and what to avoid.
The endpoint
Every ready session exposes a standard Chrome DevTools Protocol WebSocket:
This is the same protocol your local browser uses. Any CDP-compatible client works.
Connecting with patchright (recommended)
connectOverCDP attaches to the existing browser process. Do not call chromium.launch() — that starts a local browser, which is not what you want.
Connecting with Puppeteer
Connecting with raw CDP
Any WebSocket client that speaks CDP works. Here’s a minimal example using the ws package:
For production use, prefer a full CDP client library. The protocol is message-based and asynchronous — you send commands with incrementing id fields and match responses by id.
The default context
Each session has one browser context with pre-warmed state: cookies, localStorage, and navigation history that a real browser would have. Use it:
Do not call browser.createBrowserContext() or browser.newContext(). Additional contexts are not supported and will error.
Pages
The default context may have a blank page open. You can use it or create a new one:
Timeouts
CDP connections to Chaser sessions are subject to the session’s TTL. If the session expires while you’re connected, the WebSocket closes. Handle the close event and re-create the session if needed:
What you can do
The full CDP surface is available:
Page.navigate,Page.reload,Page.goBackRuntime.evaluate(run JavaScript in the page)DOM.getDocument,DOM.querySelectorInput.dispatchKeyEvent,Input.dispatchMouseEventNetwork.setCookie,Network.getCookiesEmulation.setDeviceMetricsOverride(avoid — it breaks fingerprint consistency)