/** * Page abstraction — implements IPage by sending commands to the daemon. * * All browser operations are ultimately 'exec' (JS evaluation via CDP) * plus a few native Chrome Extension APIs (tabs, cookies, navigate). * * IMPORTANT: After goto(), we remember the page identity (targetId) returned * by the navigate action and pass it to all subsequent commands. This ensures * page-scoped operations target the correct page without guessing. */ import type { BrowserCookie, BrowserDownloadWaitResult, BrowserEvaluateFunction, ScreenshotOptions } from '../types.js'; import { BasePage } from './base-page.js'; /** * Page — implements IPage by talking to the daemon via HTTP. */ export declare class Page extends BasePage { private readonly session; readonly contextId?: string | undefined; private readonly windowMode?; private readonly surface; private readonly siteSession?; private readonly _idleTimeout; constructor(session: string, idleTimeout?: number, contextId?: string | undefined, windowMode?: "foreground" | "background" | undefined, surface?: 'browser' | 'adapter', siteSession?: "ephemeral" | "persistent" | undefined); /** Active page identity (targetId), set after navigate and used in all subsequent commands */ private _page; private _networkCaptureUnsupported; private _networkCaptureWarned; /** Helper: spread session into command params */ private _sessionOpts; /** Helper: spread session + page identity into command params */ private _cmdOpts; goto(url: string, options?: { waitUntil?: 'load' | 'none'; settleMs?: number; }): Promise; /** Get the active page identity (targetId) */ getActivePage(): string | undefined; /** Bind this Page instance to a specific page identity (targetId). */ setActivePage(page?: string): void; private _markUnsupportedNetworkCapture; evaluate(js: string): Promise; evaluate(fn: BrowserEvaluateFunction, ...args: Args): Promise>; getCookies(opts?: { domain?: string; url?: string; }): Promise; /** Release the current browser session lease in the extension */ closeWindow(): Promise; tabs(): Promise; newTab(url?: string): Promise; closeTab(target?: number | string): Promise; selectTab(target: number | string): Promise; /** * Capture a screenshot via CDP Page.captureScreenshot. */ screenshot(options?: ScreenshotOptions): Promise; startNetworkCapture(pattern?: string): Promise; readNetworkCapture(): Promise; waitForDownload(pattern?: string, timeoutMs?: number): Promise; /** * Set local file paths on a file input element via CDP DOM.setFileInputFiles. * Chrome reads the files directly from the local filesystem, avoiding the * payload size limits of base64-in-evaluate. */ setFileInput(files: string[], selector?: string): Promise; insertText(text: string): Promise; frames(): Promise>; evaluateInFrame(js: string, frameIndex: number): Promise; cdp(method: string, params?: Record): Promise; handleJavaScriptDialog(accept: boolean, promptText?: string): Promise; /** CDP native click fallback — called when JS el.click() fails */ protected tryNativeClick(x: number, y: number): Promise; /** Precise click using DOM.getContentQuads/getBoxModel for inline elements */ clickWithQuads(ref: string): Promise; nativeClick(x: number, y: number): Promise; nativeType(text: string): Promise; nativeKeyPress(key: string, modifiers?: string[]): Promise; }