For the complete documentation index, see llms.txt. This page is also available as Markdown.

Use with Playwright

Setup

obscura serve --port 9222
npm install playwright

Connect

const { chromium } = require('playwright');

const browser = await chromium.connectOverCDP('ws://127.0.0.1:9222');
const context = browser.contexts()[0] || await browser.newContext();
const page = await context.newPage();

Use connectOverCDP, not connect. Playwright's connect speaks Playwright's own protocol.

await page.goto('https://example.com');
await page.goto('https://example.com', { waitUntil: 'load' });
await page.goto('https://example.com', { waitUntil: 'networkidle' });

Default is domcontentloaded. Other values: load, networkidle.

Evaluate

Interact

Locators

Cookies

Intercept requests

Multiple pages

Pages share one V8 isolate. CPU-bound JS on one page blocks the others.

Screenshots, scrolling, and PDF

A normal screenshot captures the live viewport and scroll position; fullPage: true captures document space. PDF output is raster-backed.

Screencasting

Playwright does not expose CDP screencasting as a page method. Attach a raw CDP session to the page, acknowledge every frame, and detach it when finished:

Frames are activity-driven page captures, not fixed-rate desktop video.

Disconnect

Current limits

  • Playwright page.video() and tracing artifacts that require desktop capture are not implemented. Use the raw CDP flow above for page frames.

  • BrowserContext storage-state save/restore remains limited; use --storage-dir on obscura serve, as described in Persist cookies and storage.

  • Service workers, native media, some Web APIs, long-tail CSS, and compositor behavior remain incomplete relative to Chromium.

  • PDF text is not selectable/searchable and tagged PDF is not yet available.

Last updated

Was this helpful?