Skip to main content
browser_snapshot returns the page’s accessibility tree as indented text. Every interactive or labelled element carries a ref:
The line shows the role, the accessible name, state hints such as (checked), (disabled), (expanded) or (focused), and the ref.

Refs are stable handles

A ref like e12 points at a live DOM node, not at a position or a selector. The page keeps the mapping in window.__bmcp, keyed by the element itself, so re-snapshotting an unchanged page yields the same refs and the agent can keep using ones it already knows. Refs stay valid until the DOM changes:
  • If the node is removed, any tool using its ref fails with Stale ref e12: element was removed from the page; run browser_snapshot again.
  • After a navigation the registry is gone; the agent must snapshot again.

What is included

  • Elements without a layout box (for example display: contents wrappers) are traversed so their children still appear; hidden elements and their subtrees are skipped.
  • Elements inside open shadow roots and same-origin iframes are included.
  • diff: true returns only the lines that changed since the previous snapshot of that tab, which keeps long pages cheap to re-read after a click.

Using refs elsewhere

Refs are accepted by every element-targeting tool: devtools_elements {action: "search"} goes the other way: it takes a CSS selector, XPath or text and returns refs that the automation tools can then use.