ov.capture.browser#
Playwright facade – the baseline driver (§9, D1).
This hides Playwright behind a clean lifecycle so no caller (or skill, or future
agent) ever touches a raw Playwright object. It is treated as a *facade over a
CDP escape hatch, not a wall*: BrowserSession.cdp() lazily attaches a
CdpSession for the ~20% the high-level API can’t reach.
The sync Playwright API is used deliberately – capture is a synchronous,
step-by-step orchestration and the sync API keeps the code legible. HAR is
recorded to a temp .har.zip with embedded bodies and read back after the
context closes (HAR only flushes on context.close()); structured network
records come from event accumulation in the network probe, not from the HAR.
Classes
|
Owns a Playwright browser/context/page for one capture run. |
Exceptions
Raised when Playwright or its browsers are not usable. |
- exception ov.capture.browser.BrowserNotAvailable[source]#
Bases:
RuntimeErrorRaised when Playwright or its browsers are not usable.
Carries the install hint so the message is actionable, per the project’s informative-errors principle.
- class ov.capture.browser.BrowserSession(config, *, record_har=True)[source]#
Bases:
objectOwns a Playwright browser/context/page for one capture run.
Lifecycle is explicit (
start()/close()) so the orchestrator can flush in-memory probe state before closing the context (which flushes HAR), then ingest the HAR. It is also a context manager for simple call sites.- cdp()[source]#
Lazily attach and return a
CdpSession(Chromium).Returns
Noneon non-Chromium browsers, where CDP is unavailable.
- property context#
The active Playwright
BrowserContext.
- property page#
The active Playwright
Page(raises if not started).