export interface BrowserPage { pageId: string; url: string; title: string; contextId?: string; } export interface BrowserContextInfo { contextId: string; isDefault: boolean; } export interface PageInfo extends BrowserPage { readyState: string; viewport: { width: number; height: number; deviceScaleFactor: number; isMobile: boolean; }; userAgent: string; } export interface BrowserCookie { name: string; value: string; domain?: string; path?: string; expires?: number; httpOnly?: boolean; secure?: boolean; sameSite?: string; } export interface StorageEntry { key: string; value: string; } export interface NetworkEvent { type: "request" | "response" | "failed"; requestId: string; url: string; method?: string; status?: number; statusText?: string; mimeType?: string; errorText?: string; timestamp?: number; } export interface ConsoleEvent { type: "console" | "error"; level: string; text: string; timestamp?: number; url?: string; lineNumber?: number; columnNumber?: number; } export interface FrameInfo { frameId: string; parentFrameId?: string; url: string; name?: string; mimeType?: string; } export interface PdfResult { data: string; mimeType: "application/pdf"; } export interface TraceResult { data: string; mimeType: "application/json"; } export interface AccessibilityNode { [key: string]: unknown; } export interface BrowserBackend { connect(): Promise; close(): Promise; newPage(url?: string, contextId?: string): Promise; listPages(): Promise; navigate(pageId: string, url: string): Promise; reload(pageId: string): Promise; goBack(pageId: string): Promise; goForward(pageId: string): Promise; pageInfo(pageId: string): Promise; title(pageId: string): Promise; textContent(pageId: string, selector: string): Promise; content(pageId: string): Promise; evaluate(pageId: string, expression: string): Promise; waitForSelector(pageId: string, selector: string, options?: WaitForSelectorOptions): Promise; waitForUrl(pageId: string, matcher: UrlMatcher, timeoutMs?: number): Promise; waitForLoadState(pageId: string, state: LoadState, timeoutMs?: number): Promise; waitForExpression(pageId: string, expression: string, timeoutMs?: number, pollMs?: number): Promise; click(pageId: string, selector: string): Promise; fill(pageId: string, selector: string, value: string): Promise; press(pageId: string, key: string): Promise; hover(pageId: string, selector: string): Promise; selectOption(pageId: string, selector: string, values: string[]): Promise; dragAndDrop(pageId: string, sourceSelector: string, targetSelector: string): Promise; uploadFile(pageId: string, selector: string, paths: string[]): Promise; focus(pageId: string, selector: string): Promise; blur(pageId: string, selector: string): Promise; screenshot(pageId: string, fullPage?: boolean): Promise<{ data: string; mimeType: string; }>; networkEvents(pageId: string, limit?: number): Promise; responseBody(pageId: string, requestId: string): Promise<{ body: string; base64Encoded: boolean; }>; consoleEvents(pageId: string, limit?: number): Promise; cookies(pageId: string): Promise; setCookie(pageId: string, cookie: BrowserCookie): Promise; clearCookies(pageId: string): Promise; storage(pageId: string, type: StorageType): Promise; setStorage(pageId: string, type: StorageType, key: string, value: string): Promise; clearStorage(pageId: string, type: StorageType): Promise; grantPermissions(pageId: string, permissions: string[]): Promise; resetPermissions(pageId: string): Promise; setGeolocation(pageId: string, latitude: number, longitude: number, accuracy?: number): Promise; listFrames(pageId: string): Promise; frameEvaluate(pageId: string, frameSelector: string, expression: string): Promise; createContext(): Promise; listContexts(): Promise; closeContext(contextId: string): Promise; printPdf(pageId: string): Promise; setDownloadBehavior(behavior: DownloadBehavior, downloadPath?: string): Promise; startTracing(pageId: string): Promise; stopTracing(pageId: string): Promise; accessibilitySnapshot(pageId: string): Promise; setBlockedUrls(pageId: string, patterns: string[]): Promise; closePage(pageId: string): Promise; } export type LoadState = "domcontentloaded" | "load" | "networkidle"; export type StorageType = "localStorage" | "sessionStorage"; export type DownloadBehavior = "allow" | "deny" | "default"; export interface WaitForSelectorOptions { visible?: boolean; timeoutMs?: number; pollMs?: number; } export interface UrlMatcher { exact?: string; contains?: string; regex?: string; } export interface NavigateInput { pageId?: string; url: string; } export interface NewPageInput { url?: string; contextId?: string; } export interface PageSelectorInput { pageId: string; selector: string; } export interface EvaluateInput { pageId: string; expression: string; } export interface FillInput extends PageSelectorInput { value: string; } export interface PressInput { pageId: string; key: string; } export interface ScreenshotInput { pageId: string; fullPage?: boolean; } export interface WaitForTextInput { pageId: string; text: string; timeoutMs?: number; pollMs?: number; } export interface WaitForSelectorInput extends PageSelectorInput, WaitForSelectorOptions { } export interface WaitForUrlInput { pageId: string; exact?: string; contains?: string; regex?: string; timeoutMs?: number; } export interface WaitForLoadStateInput { pageId: string; state: LoadState; timeoutMs?: number; } export interface WaitForExpressionInput { pageId: string; expression: string; timeoutMs?: number; pollMs?: number; } export interface SelectOptionInput extends PageSelectorInput { values: string[]; } export interface DragAndDropInput { pageId: string; sourceSelector: string; targetSelector: string; } export interface UploadFileInput extends PageSelectorInput { paths: string[]; } export interface LimitInput { pageId: string; limit?: number; } export interface ResponseBodyInput { pageId: string; requestId: string; } export interface SetCookieInput { pageId: string; cookie: BrowserCookie; } export interface StorageInput { pageId: string; type: StorageType; } export interface SetStorageInput extends StorageInput { key: string; value: string; } export interface PermissionInput { pageId: string; permissions: string[]; } export interface GeolocationInput { pageId: string; latitude: number; longitude: number; accuracy?: number; } export interface FrameEvaluateInput { pageId: string; frameSelector: string; expression: string; } export interface PrintPdfInput { pageId: string; } export interface DownloadBehaviorInput { behavior: DownloadBehavior; downloadPath?: string; } export interface BlockedUrlsInput { pageId: string; patterns: string[]; }