## API Reference Use this as the supported `agent.browsers.*` surface. ```ts // Installed by setupBrowserRuntime({ globals: globalThis }). const browser = await agent.browsers.get("iab"); interface Agent { browsers: Browsers; // API for finding and selecting browsers. documentation: Documentation; // API for reading packaged browser-use documentation by name. } interface Browsers { get(id: string): Promise; // Get a browser by id or client type. list(): Promise>; // List available browsers. } interface Browser { browserId: string; // Browser id selected by `agent.browsers.get()`. capabilities: BrowserCapabilityCollection; // Browser-scoped optional capabilities advertised by the connected backend; discover IDs with `await browser.capabilities.list()`, then call `await (await browser.capabilities.get(id)).documentation()` for method details. tabs: Tabs; // API for interacting with browser tabs. user: BrowserUser; // Readonly context about tabs in the user's browser windows. documentation(): Promise; // Read browser guidance and the core API reference. nameSession(name: string): Promise; // Name the current browser automation session. } interface BrowserUser { openTabs(): Promise>; // List open top-level tabs across the user's browser windows ordered by `lastOpened` descending. } interface Tabs { get(id: string): Promise; // Get a tab by id. list(): Promise>; // List open tabs in the browser. new(): Promise; // Create and return a new tab in the browser. selected(): Promise; // Return the currently selected tab, if any. } interface Tab { capabilities: TabCapabilityCollection; // Tab-scoped optional capabilities advertised by the connected backend; discover IDs with `await tab.capabilities.list()`, then call `await (await tab.capabilities.get(id)).documentation()` for method details. clipboard: TabClipboardAPI; // API for interacting with clipboard content in this tab. cua: CUAAPI; // API for interacting with the tab via the cua api dev: TabDevAPI; // API for developer-oriented tab inspection. dom_cua: DomCUAAPI; // API for interacting with the tab via the dom based cua api id: string; // A tab's unique identifier playwright: PlaywrightAPI; // API for interacting with the tab via the playwright api back(): Promise; // Navigate this tab back in history. close(): Promise; // Close this tab. forward(): Promise; // Navigate this tab forward in history. goto(url: string): Promise; // Open a URL in this tab. reload(): Promise; // Reload this tab. screenshot(options: ScreenshotOptions): Promise; // Capture a screenshot of this tab. title(): Promise; // Get the current title for this tab. url(): Promise; // Get the current URL for this tab. } interface CUAAPI { click(options: ClickOptions): Promise; // Click at a coordinate in the current viewport. double_click(options: DoubleClickOptions): Promise; // Double click at a coordinate in the current viewport. drag(options: DragOptions): Promise; // Drag from a point to a point by the provided path. keypress(options: KeypressOptions): Promise; // Press control characters at the current focused element (focus it first via click/dblclick). move(options: MoveOptions): Promise; // Move the mouse to a point by the provided x and y coordinates. scroll(options: ScrollOptions): Promise; // Scroll by a delta from a specific viewport coordinate. type(options: TypeOptions): Promise; // Type text at the current focus. } interface DomCUAAPI { click(options: DomClickOptions): Promise; // Click a DOM node by its id from the visible DOM snapshot. double_click(options: DomClickOptions): Promise; // Double-click a DOM node by its id. get_visible_dom(): Promise; // Return a filtered DOM with node ids for interactable elements. keypress(options: DomKeypressOptions): Promise; // Press control characters at the currently focused element (focus it first via click/dblclick). scroll(options: DomScrollOptions): Promise; // Scroll either the page or a specific node (if node_id provided) by deltas. type(options: DomTypeOptions): Promise; // Type text into the currently focused element (focus via click first). } interface PlaywrightAPI { domSnapshot(): Promise; // Return a snapshot of the current DOM as a string, including expanded iframe body content when available. evaluate(pageFunction: PlaywrightEvaluateFunction, arg?: TArg, options?: PlaywrightEvaluateOptions): Promise; // Evaluate JavaScript in a read-only page scope. expectNavigation(action: () => Promise, options: { timeoutMs?: number; url?: string; waitUntil?: LoadState }): Promise; // Expect a navigation triggered by an action. frameLocator(frameSelector: string): PlaywrightFrameLocator; // Create a frame-scoped locator builder. getByLabel(text: TextMatcher, options: { exact?: boolean }): PlaywrightLocator; // Find elements by label text within the page. getByPlaceholder(text: TextMatcher, options: { exact?: boolean }): PlaywrightLocator; // Find elements by placeholder text within the page. getByRole(role: string, options: { exact?: boolean; name?: TextMatcher }): PlaywrightLocator; // Find elements by ARIA role within the page. getByTestId(testId: string): PlaywrightLocator; // Find elements by test id within the page. getByText(text: TextMatcher, options: { exact?: boolean }): PlaywrightLocator; // Find elements by text within the page. locator(selector: string): PlaywrightLocator; // Create a locator scoped to this tab. waitForEvent(event: "download", options?: WaitForEventOptions): Promise; // Wait for the next event on the page. waitForLoadState(options: PageWaitForLoadStateOptions): Promise; // Wait for the page to reach a specific load state. waitForTimeout(timeoutMs: number): Promise; // Wait for a fixed duration. waitForURL(url: string, options: PageWaitForURLOptions): Promise; // Wait for the page URL to match the provided value. } interface PlaywrightFrameLocator { frameLocator(frameSelector: string): PlaywrightFrameLocator; // Create a locator scoped to a nested frame. getByLabel(text: TextMatcher, options: { exact?: boolean }): PlaywrightLocator; // Find elements by label within this frame. getByPlaceholder(text: TextMatcher, options: { exact?: boolean }): PlaywrightLocator; // Find elements by placeholder within this frame. getByRole(role: string, options: { exact?: boolean; name?: TextMatcher }): PlaywrightLocator; // Find elements by ARIA role within this frame. getByTestId(testId: string): PlaywrightLocator; // Find elements by test id within this frame. getByText(text: TextMatcher, options: { exact?: boolean }): PlaywrightLocator; // Find elements by text within this frame. locator(selector: string): PlaywrightLocator; // Create a locator scoped to this frame. } interface PlaywrightLocator { all(): Promise>; // Resolve to a list of locators for each matched element. allTextContents(options: { timeoutMs?: number }): Promise>; // Return `textContent` for *all* elements matched by this locator. and(locator: PlaywrightLocator): PlaywrightLocator; // Return a locator matching elements that satisfy both this locator and `locator`. check(options: LocatorCheckOptions): Promise; // Check a checkbox or switch-like control. click(options: LocatorClickOptions): Promise; // Click the element matched by this locator. count(): Promise; // Number of elements matching this locator. dblclick(options: LocatorClickOptions): Promise; // Double-click the element matched by this locator. fill(value: string, options: { timeoutMs?: number }): Promise; // Replace the element's value with the provided text. filter(options: LocatorFilterOptions): PlaywrightLocator; // Narrow this locator by additional constraints. first(): PlaywrightLocator; // Return a locator pointing at the first matched element. getAttribute(name: string, options: { timeoutMs?: number }): Promise; // Return an attribute value from the first matched element. getByLabel(text: TextMatcher, options: { exact?: boolean }): PlaywrightLocator; // Find elements by label text, scoped to this locator. getByPlaceholder(text: TextMatcher, options: { exact?: boolean }): PlaywrightLocator; // Find elements by placeholder text, scoped to this locator. getByRole(role: string, options: { exact?: boolean; name?: TextMatcher }): PlaywrightLocator; // Find elements by ARIA role, scoped to this locator. getByTestId(testId: string): PlaywrightLocator; // Find elements by test id, scoped to this locator. getByText(text: TextMatcher, options: { exact?: boolean }): PlaywrightLocator; // Find elements by text content, scoped to this locator. innerText(options: { timeoutMs?: number }): Promise; // Return the rendered (visible) text of the first matched element. isEnabled(): Promise; // Whether the first matched element is currently enabled. isVisible(): Promise; // Whether the first matched element is currently visible. last(): PlaywrightLocator; // Return a locator pointing at the last matched element. locator(selector: string, options: LocatorLocatorOptions): PlaywrightLocator; // Create a descendant locator scoped to this locator. nth(index: number): PlaywrightLocator; // Return a locator pointing at the Nth matched element. or(locator: PlaywrightLocator): PlaywrightLocator; // Return a locator matching elements that satisfy either this locator or `locator`. press(value: string, options: { timeoutMs?: number }): Promise; // Press a keyboard key while this locator is focused. selectOption(value: SelectOptionInput | Array, options: { timeoutMs?: number }): Promise; // Select one or more options on a native `