browser_act
Batch multiple browser actions—click, fill, hover, drag, select, press keys—into one call. Target elements by accessibility refs from snapshots or CSS selectors for reliable UI automation.
Instructions
Perform one or more browser actions in sequence. Batch multiple steps into one call.
Two ways to target an element — use whichever is more stable: • ref — accessibility ref from browser_snapshot (preferred). LLM-friendly: no selector guessing, survives CSS class churn, resistant to obfuscated build output. Each ref is pinned to the exact element captured in the snapshot, so it never silently drifts to a different element when the page reflows. If that element is removed or re-rendered, the action fails loudly ("stale ref" / element not found) — re-snapshot rather than retrying. Call browser_snapshot first to get refs like "e9", "e42", then pass them to actions: { action: "click", ref: "e9" }. • selector — raw CSS selector. Use when you already know it, or for elements not in the a11y tree.
Example ref flow:
browser_snapshot() → { snapshot, refs: [{ref: "e9", role: "button", name: "Sign in"}] }
browser_act({ commands: [{ action: "click", ref: "e9" }] })
Available actions: • click — click an element (supports left/right/middle button). Use button:'right' for context menus • hover — hover over an element for tooltips, dropdown menus, hover states • drag — drag an element to a target selector (column reorder, kanban) OR by pixel offset (column resize, sliders). Use target for element-to-element, offsetX/offsetY for precise pixel drag • clicklink — click a link/button by visible text (text-based; does not use ref/selector) • fill — fill an input field (clears first) • select — select a dropdown option • keypress — press a key (Enter, Tab, Escape, etc.) — keyboard action, no ref/selector needed • waitfor — wait for an element to appear • scrollto — scroll an element into view • wait — pause for N milliseconds (no target) • clearconsole — clear captured console logs (no target)
click, hover, drag, fill, select, waitfor, scrollto all accept either 'ref' or 'selector'. If both are provided, 'ref' wins. Refs are invalidated on navigation — re-snapshot if the page has changed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| commands | Yes | Ordered list of actions to execute |