Automation reference · v1
Drive a rendered page with bounded actions
Add an actions array to POST /screenshot. Each action locates an element, performs one bounded operation, and returns a machine-readable result. The browser runs the sequence in order and fails fast unless an individual action opts into continueOnError.
Locate
Use CSS, XPath, text, ARIA role/name, labels, IDs, test IDs, or coordinates.
Act
Click, type, scroll, navigate, wait, work with tabs, upload, or assert.
Bound
At most 25 actions per request and a 24s/52s wall-clock action budget.
01 · First flow
Automate a login-style flow
Use responseType: "json" so the response includes actionResults and any final Markdown, analysis, or artifact metadata. Secrets in this example are placeholders; never commit real passwords or cookies.
Action result shape
Each entry has index, action, status (passed, failed, or skipped), and durationMs. Failed entries may include code, error, and safe details.
02 · Locate
Choose the most stable locator
Every action uses either the legacy selector string or a new target locator object, never both. Semantic snapshot node IDs are not accepted as durable targets; copy a selector candidate from the snapshot instead.
Recommended orderPrefer role/name or label, then a stable test ID, then a purposeful CSS selector. Use coordinates only when the control cannot be described semantically.
Exact matching
Text and role/name locators support exact. It defaults to true; set it to false when the target text contains additional dynamic text.
03 · Act
Action catalog and shared fields
Interaction
click, type, select, check, uncheck, hover, focus, pressKey
Movement
scroll, scrollIntoView
Navigation
navigate, back, forward, reload
Waiting
wait, waitForText, waitForUrl, waitForRequest, waitForResponse, waitForNetworkIdle
Pages
openTab, switchTab, closeTab
Verification
assert
Files
upload
04 · Context
Work with same-origin frames and multiple tabs
Frames
Set the action frame field to address a same-origin iframe. Cross-origin frames are reported in semantic metadata but cannot be entered for actions.
Tabs
openTab creates a tab, switchTab selects a caller-visible tab ID, and closeTab closes it. The final response includes IDs of tabs that remain open.
05 · Files
Upload inline base64 files
The upload action accepts a bounded inline base64 file with a name and optional MIME type. The legacy s3Key source is withdrawn and returns a validation error; it is not a supported way to reference caller storage.
Keep uploads transient. Base64 file data is used to drive the browser input and is not exposed in results. Keep files small enough for the request-body limits and never place secrets in a public example.
06 · Operate
Understand failures, partial work, and time budgets
Actions are fail-fast by default. A failed action stops later actions unless that action sets continueOnError: true. A wall-clock action budget can also skip remaining steps.
Synchronous
24 seconds. A budget exhaustion returns HTTP 206, marks remaining actions as skipped, and reports metadata.budgetWarning.
Durable worker
52 seconds for async captures, monitor runs, batch children, and crawl children. Use async: true when navigation or actions are likely to exceed the synchronous window.
07 · Checklist
Make automation reliable
- Inspect the page with a semantic snapshot or the playground before writing actions.
- Prefer accessible role/name, label, and stable test-ID locators over generated class names.
- Keep one intent per action and use explicit waits for the state you need.
- Use continueOnError only for genuinely optional steps; do not hide a required failure.
- Use async: true for long navigation, multiple whole-DOM passes, or long action chains.
- Treat actionResults as data. A 200 response does not mean every action passed.
- Never send real credentials in documentation, logs, or committed examples.