Skip to content

Interact — Control the Browser

The interact tool gives the AI control over the browser — navigate, click, type, read elements, run JavaScript, upload files, record sessions, manage state, and display narration. Requires AI Web Pilot to be enabled in the extension popup.

Need one runnable call + response shape + failure fix for every action? See Interact Executable Examples.

interact({what: "navigate", url: "https://example.com"})
interact({what: "click", selector: "text=Submit"})
interact({what: "type", selector: "label=Email", text: "user@example.com"})
interact({what: "list_interactive"})
interact({what: "screenshot"})
interact({what: "execute_js", script: "document.title"})
interact({what: "batch", steps: [{what: "click", selector: "text=Menu"}, ...]})
interact({what: "set_cookie", name: "theme", value: "dark", domain: "example.com"})

These parameters can be added to any action:

ParameterTypeDescription
subtitlestringNarration text displayed at bottom of viewport. Empty string clears.
reasonstringWhy this action is being performed — shown in the action toast
correlation_idstringLink this action to a specific error or investigation
analyzebooleanEnable performance profiling (returns perf_diff in result)
tab_idnumberTarget a specific tab (omit for active tab)
element_idstringStable element handle from list_interactive (preferred for deterministic follow-up actions)
indexnumberElement index from list_interactive results (legacy alternative to selector/element_id)
index_generationstringGeneration token from list_interactive to ensure index resolves against the same element snapshot
scope_selectorstringContainer CSS selector to constrain DOM actions to a specific region
include_screenshotbooleanCapture a screenshot after the action completes and return it inline
evidencestringVisual evidence capture mode: off (default), on_mutation, always
observe_mutationsbooleanTrack element-level DOM mutations during action execution
wait_for_stablebooleanWait for DOM stability (no mutations) before returning. Composable with navigate and click.
framestringTarget iframe: CSS selector, 0-based index, or "all"

Subtitles are persistent narration text displayed at the bottom of the viewport, like closed captions. They stay visible until replaced or cleared.

// Standalone
interact({what: "subtitle", text: "Creating a new project"})
// Composable — narration + action in one call
interact({what: "click", selector: "text=Create",
subtitle: "One click to start a new project"})
// Clear
interact({what: "subtitle", text: ""})

When enabled, action toasts show brief notifications at the top of the viewport for each action. The reason parameter customizes the toast label:

// Without reason: toast shows "Click: #submit-btn"
interact({what: "click", selector: "#submit-btn"})
// With reason: toast shows "Submit the registration form"
interact({what: "click", selector: "#submit-btn", reason: "Submit the registration form"})

Toasts can be toggled off in the extension popup — useful during demos.


All actions that accept a selector parameter support semantic selectors in addition to CSS:

SyntaxExampleHow it works
text=text=SubmitFinds element whose text content contains “Submit”
role=role=buttonFinds [role="button"]
placeholder=placeholder=EmailFinds [placeholder="Email"]
label=label=UsernameFinds label containing text, follows for attribute to target
aria-label=aria-label=CloseFinds [aria-label="Close"] with starts-with matching
CSS#submit-btnStandard document.querySelector()

Semantic selectors are resilient to UI changes — they target meaning, not structure. text=Submit still works after a CSS redesign, a framework migration, or a component library upgrade.

The aria-label= selector uses starts-with matching, so aria-label=Send matches Gmail’s "Send ‪(⌘Enter)‬".

Use the frame parameter to target elements inside iframes:

interact({what: "click", selector: "text=Submit", frame: "#payment-iframe"})
interact({what: "type", selector: "label=Card", text: "4242...", frame: 0})
ValueBehavior
CSS selectorTarget iframe matching the selector
NumberTarget iframe by 0-based index
"all"Search all iframes

interact({what: "navigate", url: "https://example.com"})

Navigates the active tab to the specified URL. Automatically includes perf_diff in the async result (before/after performance comparison).

ParameterTypeDescription
urlstring (required)URL to navigate to
include_contentbooleanReturn page content with response (url, title, text_content, vitals)
new_tabbooleanOpen URL in a background tab instead of replacing current tab
auto_dismissbooleanAfter navigation completes, automatically dismiss cookie consent banners and overlays
interact({what: "refresh"})

Refreshes the current page. Includes perf_diff automatically.

interact({what: "back"})
interact({what: "forward"})

Browser history navigation.

interact({what: "new_tab", url: "https://example.com"})

Opens a new tab with the specified URL.

ParameterTypeDescription
urlstring (required)URL to open in the new tab

Switch to a different browser tab.

interact({what: "switch_tab", tab_id: 123})
interact({what: "switch_tab", tab_index: 2})
ParameterTypeDescription
tab_idnumberTab ID to switch to
tab_indexnumberTab index in current window ordering (alternative to tab_id)
set_trackedbooleanWhether to update the tracked tab to the newly activated tab (default: true). Set to false to switch focus without changing which tab the server targets.

Close a browser tab.

interact({what: "close_tab", tab_id: 123})
ParameterTypeDescription
tab_idnumberTab ID to close (omit for active tab)

Activate (bring to front) a specific browser tab.

interact({what: "activate_tab", tab_id: 123})
ParameterTypeDescription
tab_idnumberTab ID to activate

interact({what: "click", selector: "text=Submit"})
interact({what: "click", selector: "#confirm-btn", reason: "Confirm the order"})
ParameterTypeDescription
selectorstringCSS or semantic selector
interact({what: "type", selector: "label=Email", text: "user@example.com"})
interact({what: "type", selector: "placeholder=Search", text: "wireless headphones", clear: true})
ParameterTypeDescription
selectorstringCSS or semantic selector
textstringText to type
clearbooleanClear existing value before typing
interact({what: "select", selector: "#country", value: "US"})
ParameterTypeDescription
selectorstringCSS or semantic selector for <select> element
valuestringOption value to select
interact({what: "check", selector: "text=I agree to the Terms"})
interact({what: "check", selector: "#newsletter", checked: false})
ParameterTypeDefaultDescription
selectorstringCSS or semantic selector
checkedbooleantrueWhether to check or uncheck
interact({what: "key_press", selector: "label=Search", text: "Enter"})
interact({what: "key_press", text: "Escape"})
ParameterTypeDescription
selectorstringElement to target (optional — omit for page-level key press)
textstringKey name: Enter, Tab, Escape, Backspace, ArrowDown, ArrowUp, Space
interact({what: "focus", selector: "label=Email"})

Hover over an element.

interact({what: "hover", selector: "text=Products"})
interact({what: "hover", selector: ".dropdown-trigger"})
ParameterTypeDescription
selectorstringCSS or semantic selector

Click using OS-level hardware simulation instead of DOM events. Useful for elements that don’t respond to synthetic clicks (e.g., custom canvas, embedded iframes with strict event handling).

interact({what: "hardware_click", selector: "#canvas-element"})
ParameterTypeDescription
selectorstringCSS or semantic selector
interact({what: "scroll_to", selector: "#pricing-section"})

Wait for an element to appear on the page. Useful for async content.

interact({what: "wait_for", selector: "text=Dashboard", timeout_ms: 10000})
ParameterTypeDefaultDescription
selectorstringCSS or semantic selector
timeout_msnumber5000Maximum wait time in milliseconds

Wait for the DOM to stop changing (no mutations) before returning. Useful after dynamic content loads.

interact({what: "wait_for_stable"})
interact({what: "wait_for_stable", stability_ms: 1000})
ParameterTypeDefaultDescription
stability_msnumber500Milliseconds of DOM quiet time required

interact({what: "get_text", selector: ".order-total"})

Returns the text content of the matched element.

interact({what: "get_value", selector: "input[name='email']"})

Returns the current value of a form element.

interact({what: "get_attribute", selector: "#submit", name: "disabled"})
ParameterTypeDescription
namestringAttribute name to read

Run selector queries without mutating page state.

interact({what: "query", selector: "text=Submit", query_type: "exists"})
interact({what: "query", selector: ".error", query_type: "count"})
interact({what: "query", selector: "#status", query_type: "text"})
ParameterTypeDescription
query_typestringexists, count, text, text_all, or attributes
attribute_namesarrayAttribute names when query_type is attributes
interact({what: "set_attribute", selector: "#submit", name: "disabled", value: "false"})
ParameterTypeDescription
namestringAttribute name
valuestringValue to set

Discovers all interactive elements on the page — buttons, links, inputs, selects, etc. Returns up to 100 elements with suggested selectors.

interact({what: "list_interactive"})
interact({what: "list_interactive", limit: 20, visible_only: true})
ParameterTypeDescription
limitnumberMax elements to return (default: all)
visible_onlybooleanOnly return visible elements

Returns an array of elements, each with:

FieldDescription
tagElement tag name (button, input, a, etc.)
typeInput type (email, password, text) — only for <input>
selectorSuggested selector (semantic preferred: text=, aria-label=, placeholder=)
labelHuman-readable label (aria-label > title > placeholder > text content)
roleARIA role
visibleWhether the element is visible on screen

This is the best way to discover what’s clickable on an unfamiliar page. The AI can read the list and choose the right selector.


Run arbitrary JavaScript in the page context. See How Gasoline Executes Page Scripts for the full deep dive.

interact({what: "execute_js", script: "document.title"})
interact({what: "execute_js", script: "window.location.href"})
interact({what: "execute_js",
script: "document.querySelectorAll('li').length",
world: "main"})
ParameterTypeDefaultDescription
scriptstringJavaScript code to execute
worldstringautoauto (try main, fallback to isolated), main (page globals), isolated (CSP-proof)
timeout_msnumber5000Maximum execution time

Highlights an element on the page with a visual overlay. Useful for demos and debugging.

interact({what: "highlight", selector: "#error-message"})
interact({what: "highlight", selector: "text=Submit", duration_ms: 3000})
ParameterTypeDefaultDescription
selectorstringElement to highlight
duration_msnumber5000How long to show the highlight

Display persistent narration text at the bottom of the viewport.

interact({what: "subtitle", text: "Welcome to the product tour"})
interact({what: "subtitle", text: ""}) // Clear
ParameterTypeDescription
textstring (required)Narration text. Empty string clears.

Save the current browser state (URL, title, tab) as a named checkpoint.

interact({what: "save_state", snapshot_name: "logged-in"})

Restore a saved state checkpoint.

interact({what: "load_state", snapshot_name: "logged-in"})
interact({what: "load_state", snapshot_name: "logged-in", include_url: true})
ParameterTypeDefaultDescription
snapshot_namestringName of the saved state
include_urlbooleanfalseNavigate to the saved URL when restoring
interact({what: "list_states"})

Returns all saved states with metadata (name, URL, title, saved_at).

interact({what: "delete_state", snapshot_name: "old-checkpoint"})

Set a key in localStorage or sessionStorage.

interact({what: "set_storage", storage_type: "localStorage", key: "theme", value: "dark"})
interact({what: "set_storage", storage_type: "sessionStorage", key: "debug", value: "true"})
ParameterTypeDescription
storage_typestringlocalStorage or sessionStorage
keystringStorage key
valuestringValue to set

Remove a key from localStorage or sessionStorage.

interact({what: "delete_storage", storage_type: "localStorage", key: "theme"})
ParameterTypeDescription
storage_typestringlocalStorage or sessionStorage
keystringStorage key to delete

Clear all keys from localStorage or sessionStorage.

interact({what: "clear_storage", storage_type: "localStorage"})
ParameterTypeDescription
storage_typestringlocalStorage or sessionStorage

Set a browser cookie.

interact({what: "set_cookie", name: "session_id", value: "abc123", domain: "example.com"})
ParameterTypeDescription
namestringCookie name
valuestringCookie value
domainstringCookie domain
pathstringCookie path (default: /)

Delete a browser cookie.

interact({what: "delete_cookie", name: "session_id", domain: "example.com"})
ParameterTypeDescription
namestringCookie name
domainstringCookie domain
pathstringCookie path (default: /)

Accept (confirm/OK) the topmost browser dialog (alert, confirm, prompt).

interact({what: "confirm_top_dialog"})

Dismiss the topmost overlay, modal, or popup on the page.

interact({what: "dismiss_top_overlay"})

Automatically detect and dismiss cookie consent banners, newsletter popups, and other overlays.

interact({what: "auto_dismiss_overlays"})

Upload a file via native file dialogs. Works with <input type="file"> elements and drag-and-drop zones.

interact({what: "upload", selector: "input[type='file']", file_path: "/path/to/report.pdf"})
ParameterTypeDescription
selectorstringFile input element selector
file_pathstringAbsolute path to the file to upload
namestringFilename (alternative to file_path)
api_endpointstringAPI endpoint for direct upload mode
submitbooleanSubmit form after upload

Activate the visual annotation overlay. Users draw rectangles on the page and type feedback. Press ESC to finish. Retrieve annotations with analyze({what: "annotations"}).

interact({what: "draw_mode_start"})
interact({what: "draw_mode_start", annot_session: "checkout-review", wait: true, timeout_ms: 300000})
ParameterTypeDefaultDescription
annot_sessionstringNamed session for multi-page annotation review
waitbooleanBlock until the user finishes drawing (press ESC)
timeout_msnumber300000Max wait time (only with wait: true, max 600000)

Start video recording of the current tab.

interact({what: "screen_recording_start"})
interact({what: "screen_recording_start", name: "checkout-flow", audio: "tab", fps: 30})
ParameterTypeDefaultDescription
namestringAuto-generatedRecording name
audiostringAudio source: tab, mic, or both. Omit for video-only.
fpsnumber15Frames per second (5-60)

Stop the active video recording.

interact({what: "screen_recording_stop"})
interact({what: "screen_recording_stop", name: "checkout-flow"})
ParameterTypeDescription
namestringRecording name (if multiple active)

Capture a screenshot from the interact tool. Prefer observe({what: "screenshot"}) for passive captures — this version is useful when composing with other interact actions via include_screenshot.

interact({what: "screenshot"})
interact({what: "screenshot", selector: ".hero-section"})
ParameterTypeDefaultDescription
selectorstringCapture a specific element by CSS selector
full_pagebooleanfalseCapture the full scrollable page
formatstringpngImage format: png or jpeg
qualitynumberJPEG quality 1-100 (only for jpeg)
wait_for_stablebooleanfalseWait for layout to stabilize before capture

Read the current clipboard text.

interact({what: "clipboard_read"})

Write text to the clipboard.

interact({what: "clipboard_write", text: "Deploy status: green"})

Paste text at the currently focused element.

interact({what: "paste", text: "Hello, world!"})
ParameterTypeDescription
textstringText to paste

Open the page’s native compose/new-message UI (e.g., Gmail’s compose window).

interact({what: "open_composer"})

Submit the currently active compose form.

interact({what: "submit_active_composer"})

Extract the page content as readable text (similar to reader mode).

interact({what: "get_readable"})

Extract the page content as markdown.

interact({what: "get_markdown"})

These actions combine multiple steps into a single call, reducing round-trips.

Navigate to a URL and wait for a specific element to appear before returning.

interact({what: "navigate_and_wait_for", url: "https://example.com/dashboard", wait_for: ".dashboard-loaded"})
ParameterTypeDescription
urlstring (required)URL to navigate to
wait_forstringCSS selector to wait for after navigation
timeout_msnumberMax wait time for the selector

Navigate and return a structured page snapshot in one call.

interact({what: "navigate_and_document", url: "https://example.com/docs"})
interact({what: "navigate_and_document", url: "https://example.com/docs", include_screenshot: true})

Fill multiple form fields without submitting. Use when you need to fill fields and then perform additional actions before submission.

interact({what: "fill_form",
fields: [
{selector: "label=Email", value: "user@example.com"},
{selector: "label=Name", value: "Jane Doe"}
]})
ParameterTypeDescription
fieldsarrayForm fields: [{selector, value, index?}]

Fill multiple form fields and submit the form in a single action.

interact({what: "fill_form_and_submit",
fields: [
{selector: "label=Email", value: "user@example.com"},
{selector: "label=Password", value: "password123"}
],
submit_selector: "text=Sign In"})
ParameterTypeDescription
fieldsarrayForm fields: [{selector, value, index?}]
submit_selectorstringCSS or semantic selector for submit button
submit_indexnumberSubmit button index from list_interactive (alternative to selector)

Run an accessibility audit and export results as SARIF in one step.

interact({what: "run_a11y_and_export_sarif", save_to: "/tmp/a11y.sarif"})
ParameterTypeDescription
save_tostringFile path to save the SARIF report

Autonomous page exploration — discovers interactive elements, follows links, and maps the page structure.

interact({what: "explore_page"})

Execute multiple interact actions sequentially in a single call. Reduces round-trips for multi-step flows.

interact({what: "batch",
steps: [
{what: "navigate", url: "https://example.com/login"},
{what: "type", selector: "label=Email", text: "user@example.com"},
{what: "type", selector: "label=Password", text: "password123"},
{what: "click", selector: "text=Sign In"}
]})
ParameterTypeDefaultDescription
stepsarray (required)Ordered list of interact action objects
step_timeout_msnumber10000Timeout per step
continue_on_errorbooleantrueContinue executing remaining steps after a failure
stop_after_stepnumberStop execution after this many steps

Add analyze: true to any DOM action to get a perf_diff in the result — before/after timing comparison with Web Vitals ratings and a verdict.

interact({what: "click", selector: "text=Load Dashboard", analyze: true})

The navigate and refresh actions include perf_diff automatically.