TheDocumentation Index
Fetch the complete documentation index at: https://docs.agentastic.dev/llms.txt
Use this file to discover all available pages before exploring further.
dev browser command lets AI agents and users control Agentastic’s built-in browser from the terminal. It communicates with the app over a Unix domain socket using JSON-RPC, giving agents full programmatic access to browser state and interactions during development and testing.
All commands follow this pattern:
Environment variables
| Variable | Required | Description |
|---|---|---|
AGENTASTIC_SOCKET_PATH | Yes | Path to the Unix domain socket. Set automatically in Agentastic terminals. |
AGENTASTIC_BROWSER_ID | No | Default browser tab ID. Avoids passing --browser-id on every command. |
Global flags
| Flag | Description |
|---|---|
--browser-id <id> | Override the browser tab ID for this invocation |
--help | Show help message |
--version | Show version |
Element selectors
Commands that accept a<selector> argument support two formats:
- CSS selectors — for example,
#login-btn,.nav a,input[name=email] @eNreferences — for example,@e1,@e5— assigned by thesnapshotcommand
@eN references when you want to refer to an element returned by a previous snapshot call. Use CSS selectors for elements you can identify directly.
Commands
Snapshot and inspection
snapshot
Take an accessibility snapshot of the page. Returns a tree of elements with roles, names, and @eN references you can use in subsequent commands.
screenshot
Take a screenshot of the page. By default, saves a PNG file and prints the path.
highlight <selector>
Highlight an element with a red dashed outline for 2 seconds. Useful for visual debugging.
Actions
click <selector>
Click an element. Scrolls it into view first.
dblclick <selector>
Double-click an element.
fill <selector> <value>
Clear a field and set its value. Works with React controlled inputs.
type <selector> <text>
Type text character by character into an element. Fires keydown, input, and keyup for each character. Use this when fill does not trigger the right events.
press <selector> <key>
Press a key on an element. Dispatches keydown, keypress, and keyup. Supports modifier keys.
keydown <selector> <key>
Dispatch only a keydown event on an element.
keyup <selector> <key>
Dispatch only a keyup event on an element.
hover <selector>
Hover over an element. Fires mouseenter and mouseover.
focus <selector>
Focus an element.
check <selector>
Check a checkbox.
uncheck <selector>
Uncheck a checkbox.
select <selector> <value>
Select an option in a <select> dropdown.
scroll <x> <y> [selector]
Scroll by x,y pixels. Optionally scroll within a specific element.
scroll_into_view <selector>
Scroll an element into the visible viewport.
eval <javascript>
Evaluate JavaScript in the page context. Returns the result.
focus_webview
Make the WKWebView the first responder, giving keyboard focus to the browser.
is_webview_focused
Check whether the WKWebView currently has keyboard focus.
Navigation
navigate <url>
Navigate to a URL.
back
Go back in browser history.
forward
Go forward in browser history.
reload
Reload the current page.
Wait
All wait commands support an optional--timeout <ms> flag.
wait selector <selector> [--timeout <ms>]
Wait for an element matching the selector to appear in the DOM.
wait text <text> [--timeout <ms>]
Wait for text to appear anywhere on the page.
wait url <pattern> [--timeout <ms>]
Wait for the page URL to contain a substring.
wait load [--timeout <ms>]
Wait for the page to finish loading (document.readyState === 'complete').
Get
get url
Get the current page URL.
get title
Get the current page title.
get text [selector]
Get text content. Without a selector, returns the full page text.
get html [selector]
Get HTML content. Without a selector, returns the full page HTML.
get value <selector>
Get the value of a form input.
get attr <selector> <attribute>
Get an HTML attribute value.
get count <selector>
Count elements matching a CSS selector.
get box <selector>
Get the bounding box (x, y, width, height) of an element.
get styles <selector> <properties>
Get computed CSS styles. Properties are comma-separated.
State queries
is visible <selector>
Check if an element is visible.
is enabled <selector>
Check if a form element is enabled (not disabled).
is checked <selector>
Check if a checkbox or radio button is checked.
Console and errors
console list
List all console messages (log, info, warn, error).
console errors
List only console errors.
console clear
Clear all captured console messages.
errors list
List uncaught JavaScript errors captured via window.onerror and unhandledrejection. Includes source file, line number, and column.
Find
Find commands locate elements by accessible properties and return matching selectors.find role <role>
Find elements by ARIA role.
find text <text>
Find elements containing specific text.
find label <label>
Find form elements by their label text.
find placeholder <text>
Find inputs by placeholder text.
find testid <id>
Find elements by data-testid attribute.
find alt <alt>
Find elements by alt attribute (images and areas).
find title <title>
Find elements by title attribute.
find first <selector>
Find the first element matching a CSS selector. Returns a unique selector.
find last <selector>
Find the last element matching a CSS selector.
find nth <selector> <index>
Find the Nth element matching a CSS selector (0-indexed).
Tab management
list
List all open browser tabs with their IDs and URLs.
open <url>
Open a URL in a new browser tab. Returns the new tab’s browser ID.
open_split <url>
Open a URL in a new split browser tab.
close [browser_id]
Close a browser tab. Without an ID, closes the current tab.
focus_tab <browser_id>
Switch focus to a specific browser tab.
tab new <url>
Open a URL in a new tab. Alias for open.
tab list
List all open tabs. Alias for list.
tab switch <browser_id>
Switch to a specific tab. Alias for focus_tab.
tab close [browser_id]
Close a tab. Alias for close.
Dialogs
These commands handle JavaScriptalert(), confirm(), and prompt() dialogs.
dialog accept [prompt_text]
Accept a pending dialog, or pre-configure acceptance for the next one. Optionally provide text for prompt() dialogs.
dialog dismiss
Dismiss a pending dialog, or pre-configure dismissal for the next one. For confirm() this returns false; for prompt() this returns null.
Cookies
cookies get [--name <name>] [--domain <domain>]
Get cookies, optionally filtered by name and/or domain.
cookies set <name> <value> [--domain <domain>] [--path <path>]
Set a cookie.
cookies clear [--name <name>] [--domain <domain>]
Clear cookies, optionally filtered.
Storage
storage get <local|session> [key]
Get localStorage or sessionStorage values. Without a key, returns all entries.
storage set <local|session> <key> <value>
Set a storage value.
storage clear <local|session> [key]
Clear storage. Without a key, clears all entries.
State persistence
state save <path>
Save the browser’s current state — cookies, localStorage, sessionStorage, and URL — to a JSON file.
state load <path>
Restore browser state from a previously saved JSON file. Restores cookies, navigates to the saved URL, then restores storage.
Frames
frame select <selector>
Select an iframe. After this, all subsequent commands (click, fill, snapshot, and so on) operate inside the iframe’s document.
Frame selection only works with same-origin iframes. Cross-origin iframes return an error.
frame main
Return to the main document. Call this after you finish interacting with an iframe.
Downloads
download wait <path> [--timeout <ms>]
Wait for a file to appear at the given path. Polls until the file exists and has content.
Script and style injection
addinitscript <javascript>
Add a user script that runs at document start on every page load. Persists across navigations.
addscript <javascript>
Evaluate JavaScript immediately in the page context. Same as eval, but named for consistency with the automation API.
addstyle <css>
Inject a CSS stylesheet into the page.
System
ping
Health check. Returns {"status":"ok"} if the socket server is running.