Playwright connects to a ready cloud browser through a one-time CDP address. Manage the run through HTTP or MCP, then use chromium.connectOverCDP(cdp_url) for page work. If the connection drops, request a fresh address for the same run.
Connection order
- Read the live setup reference; check identity and current pricing.
- Create one time-limited run with a stable idempotency key and wait for ready.
- Request control for that run. The short-lived, single-connection address is sensitive.
- Connect to the default browser context and reuse an existing page; create any extra page inside that context.
- Retrieve downloads before explicitly ending the run your Agent created.
import { chromium } from 'playwright';
const browser = await chromium.connectOverCDP(cdp_url);
const context = browser.contexts()[0];
const page = context.pages()[0] ?? await context.newPage();
await page.goto('https://docs.python.org/3/whatsnew/3.13.html');
const title = await page.title();
console.log(title);
await browser.close(); // disconnects only; end the run separatelyReconnect after a drop
If the connection expires or drops while the original run is still ready, request a new control address for that run. Find and inspect the original page. Do not reuse the old address, create an unnecessary second run, or replay a write action with an unknown outcome.
See the OpenAPI contract for fields and errors. Patchright users should follow its version-specific guide.