Member Junction
    Preparing search index...

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    Methods

    • Capture a snapshot of the given origin's client-side storage (localStorage

      • IndexedDB) for later restore into a fresh context — the warm-seed that kills the per-test cold-boot metadata refetch. The caller (driver) captures once post-login and reuses the seed across contexts.

      Default returns null (nothing to capture) so adapters without a live page don't break — additive and non-throwing. Adapters backed by a real page (e.g. Playwright) override this.

      Parameters

      • origin: string

        Origin (protocol + host + port) to snapshot.

      Returns Promise<ContextSeed | null>

    • Capture ONE frame on demand and push it through the active screencast's frame callback.

      CDP's Page.screencastFrame only fires on a viewport REPAINT, so the very first navigation (and navigations to pages that paint identically) can leave the live view blank until some later change. This grabs the current viewport via a screenshot (encoded to match the screencast format) and emits it as the next sequence-numbered frame, so callers can force an immediate refresh right after starting the stream and after a navigation settles.

      No-op (resolves) when no screencast is running or no page is open — safe to call opportunistically.

      Returns Promise<void>

    • Extract the page's interactive elements (buttons/links/inputs/ARIA roles/ click affordances) as a stable indexed list for element-grounded perception. The returned indices are what a subsequent ClickElement/TypeIntoElement action resolves against, so an adapter that implements this MUST cache the result to resolve those actions.

      Default returns an empty list so adapters without a live DOM don't break — element grounding then simply has nothing to offer and the engine falls back to coordinate actions. Adapters backed by a real page override this.

      Returns Promise<InteractiveElement[]>

    • Read the page's CURRENT text selection (window.getSelection().toString()).

      Used by the remote-browser human "copy-out" path — the viewer reads what the human selected on the remote page and writes it to the local clipboard. Default implementation returns an empty string so adapters without a live page don't break — it's a non-throwing, additive default. Adapters backed by a real page (e.g. Playwright) override this to return the live selection.

      Returns Promise<string>

      The selected text, or '' when nothing is selected / unavailable.

    • Capture the current page's title for cheap perception / sync.

      Default implementation returns an empty string so adapters without a live page don't break — it's a non-throwing, additive default. Adapters backed by a real page (e.g. Playwright) override this to return the page title.

      Returns Promise<string>

      The page title, or '' when unavailable.

    • Introspect a single element matched by a CSS selector — its existence, visibility, text, and bounding box — without ever throwing on a miss.

      Default implementation reports the element as absent so adapters that cannot query the DOM don't break — additive and non-throwing. Adapters backed by a real page (e.g. Playwright) override this.

      Parameters

      • selector: string

        CSS selector identifying the target element.

      Returns Promise<ElementInfo>

      An ElementInfo; { Exists:false, Visible:false, Text:'' } when missing.

    • Reset per-session state for the given origin while preserving auth tokens.

      Intended for shared-context adapters: between tests in the same browser context, cached state from the previous test (IndexedDB metadata cache, sessionStorage, service workers, non-auth localStorage entries) can deadlock the next test's app initialization. This method clears that state so the next test starts clean — but preserves Auth0 / OAuth tokens in localStorage so the user stays logged in.

      Default implementation is a no-op. Adapters that own a context across test boundaries (e.g., SharedContextBrowserAdapter) override this.

      Best-effort: never throws — all errors are swallowed.

      Parameters

      • _origin: string

      Returns Promise<void>

    • Restricts where this browser may go, for a browser an agent drives (a test harness leaves it unrestricted). Navigation then opens only http(s) pages and about:blank. With allowedPrivateHosts, a request to a loopback, link-local or private-network host (listed ones, as host or host:port, excepted) is aborted, and a main-frame navigation that lands on one (a redirect) is sent back to about:blank. Can be called again to replace the list.

      ponytail: best effort, by hostname, for the main frame (see NavigationGuard.IsPrivateNetworkHost). Gets through: names that resolve to private addresses, WebSockets, service-worker fetches, an iframe whose source redirects to a private host, redirects of the page's own requests, and the redirect request itself (only where it lands is refused). Real isolation is network egress rules on the machine the browser runs on.

      Parameters

      • allowedPrivateHosts: string[] | null

      Returns Promise<void>

    • Set extra HTTP headers for all requests to a specific domain.

      Uses Playwright's page.route() to intercept requests and inject headers for matching domains. The interceptor is set up once on the first call; subsequent calls just update the headers map.

      Headers are additive — calling this multiple times for the same domain merges headers (later calls override conflicting keys).

      Parameters

      • domain: string
      • headers: Record<string, string>

      Returns Promise<void>

    • Set localStorage entries for a specific domain.

      If the page is already on the target domain, entries are set directly via page.evaluate(). If not (e.g. on about:blank before first navigation), entries are deferred via page.addInitScript() so they run before page scripts on the next navigation — this avoids the origin mismatch that would occur from navigating to https://{domain} when the actual target is a different origin (e.g. http://localhost:4201).

      Parameters

      • domain: string
      • entries: Record<string, string>

      Returns Promise<void>

    • Start capturing the audio playing inside the browser tab and invoke onChunk for each encoded slice.

      Mechanism (in-page, headless-safe, no OS audio device, no extension): a capture agent is injected via Playwright page.exposeBinding('__mjAudioChunk', …)

      • page.addInitScript(…). The agent watches the DOM for <video> / <audio> elements (a MutationObserver plus an initial scan), taps the FIRST one that is actively playing with element.captureStream(), and feeds its audio tracks to an in-page MediaRecorder({ mimeType: 'audio/webm;codecs=opus' }) with a ~250ms timeslice. Each dataavailable blob is base64-encoded and sent back through the binding, which lands here and is mapped to an AudioCaptureChunk. The agent restarts the recorder when the active element swaps / plays / pauses.

      Calling start while a capture is already running is a no-op (the existing capture keeps feeding chunks).

      Limitation: only audio routed through a media ELEMENT is captured (covers YouTube and most video/audio sites). Pure Web-Audio-API sound and DRM/EME media (where captureStream() is blocked) are NOT captured — a server-side virtual audio sink is the documented future path for full-fidelity / DRM audio.

      Parameters

      • onChunk: (chunk: AudioCaptureChunk) => void

        Callback invoked with each captured audio chunk.

      Returns Promise<void>

    • Begin recording a forensic trace of the session (DOM snapshots + screenshots + network + console) for later offline inspection.

      Default implementation is a no-op resolve so adapters that can't produce a trace (or non-CDP backends) don't break — additive and non-throwing. Adapters backed by a real browser context (e.g. Playwright) override this to call context.tracing.start(...). The caller decides whether to capture (and whether to keep the result); the adapter only knows how.

      Returns Promise<void>

    • Wait until the page reaches a given load state.

      Useful after a navigation/action to let the page settle before the next perception step. Default implementation is a no-op resolve so adapters that cannot observe load state don't break — additive and non-throwing. Adapters backed by a real page (e.g. Playwright) override this.

      Parameters

      • state: "networkidle" | "load" | "domcontentloaded"

        'load', 'domcontentloaded', or 'networkidle'.

      Returns Promise<void>