/** * Enhanced snapshot with element refs for deterministic element selection. * * Derived from agent-browser by Vercel Inc. (Apache 2.0) * https://github.com/anthropics/agent-browser * * This module generates accessibility snapshots with embedded refs that can be * used to click/fill/interact with elements without re-querying the DOM. * * Example output: * - heading "Example Domain" [ref=e1] [level=1] * - paragraph: Some text content * - button "Submit" [ref=e2] * - textbox "Email" [ref=e3] * * Usage: * browser_snapshot session=main # Full snapshot * browser_snapshot session=main interactive=true # Interactive elements only * browser_click session=main selector=@e2 # Click element by ref */ import type { Page, Locator } from 'playwright'; import type { RefMap } from './types.js'; export interface EnhancedSnapshot { tree: string; refs: RefMap; } export interface SnapshotOptions { /** Only include interactive elements (buttons, links, inputs, etc.) */ interactive?: boolean; /** Maximum depth of tree to include (0 = root only) */ maxDepth?: number; /** Remove structural elements without meaningful content */ compact?: boolean; /** CSS selector to scope the snapshot */ selector?: string; } /** * Get enhanced snapshot with refs and optional filtering */ export declare function getEnhancedSnapshot(page: Page, options?: SnapshotOptions): Promise; /** * Parse a ref from command argument (e.g., "@e1" -> "e1") */ export declare function parseRef(arg: string): string | null; /** * Check if a selector string is a ref */ export declare function isRef(selector: string): boolean; /** * Get a Playwright locator from a ref using the refMap */ export declare function getLocatorFromRef(page: Page, refMap: RefMap, selector: string): Locator | null; /** * Get snapshot statistics */ export declare function getSnapshotStats(tree: string, refs: RefMap): { lines: number; chars: number; tokens: number; refs: number; interactive: number; }; //# sourceMappingURL=snapshot.d.ts.map