Snapshot the page for an agent
The page's accessibility tree as compact text with a ref on every node you can act on.
Snapshot selector of the page
Details #
@e1 link "Pull requests" href=/pulls
@e2 textbox "Search" [focused]
@e3 button "Save" [disabled]
interactive (the default) keeps only what can be acted on: links, buttons, fields, menus, checkboxes, with headings as landmarks. Off, it is the whole tree. selector scopes it to one element. The result is {text, refs, url, title}; refs maps e3 to its role, name and a selector.
Every selector param then accepts a ref: browser.click {selector: "@e3"}. A ref lives until the tab navigates; a stale one fails with "the page changed since the snapshot", and the step says to take a snapshot again. With url or html the snapshot is of a page nobody has open, where visibility and focus are unknown and left out.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
browser | one of | safari chrome front | ||
html | text | |||
impersonate | one of | auto chrome safari none | ||
interactive | yes / no | , maxNodes: 6,000 nodes by default. | ||
into | text | The variable that receives the result. | ||
maxNodes | number | |||
sample | any value | |||
selector | text | Scope to one element. | ||
signIn | text | |||
tab | any value | , browser, timeout. | ||
timeout | number | |||
url | text | , html, via, signIn, impersonate: A page nobody has open. | ||
via | one of | tab fetch auto |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
- Snapshot the page for an agent
Gotchas #
A snapshot is capped at 1 MB; a page with more says so in the step's note.