session_extract
Capture the current page state as Semantic JSON, or diff it against a prior snapshot to get only added, removed, and changed nodes plus observed behavior.
Instructions
Snapshot the CURRENT state of an open session as Semantic JSON (same shape as extract_semantic_dom, plus snapshot_id). Pass diff_against: 'previous' (or a snapshot_id) to receive only what changed: added nodes (new toasts/dialogs/fields), removed nodes, changed properties (value, is_disabled, aria_invalid, described_by…) and the behavior observed in between — far smaller than a full re-extraction and exactly the assertion list for the step. Diff identity: frame + test-id, else id, else placeholder, else tag+role+accessible name (+ document-order index); a renamed node with no stable attribute shows as removed + added; primary_locator.playwright changes say which locator is valid in which state.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | 'outline': the page as a map (regions with `selector`, structured tables, dialogs, alerts) in a few thousand characters; does not consume a snapshot id. | nodes |
| roles | No | Keep only nodes with these roles or tags (e.g. ['button','textbox','row']). | |
| scope | No | CSS selector to extract within — take it from an outline region's `selector` (e.g. 'main table', '[role="dialog"]'). Everything outside is skipped. | |
| max_nodes | No | Cap on extracted nodes; truncation is flagged, never silent. | |
| session_id | Yes | From session_open. | |
| diff_against | No | Return only what changed since that snapshot_id (or 'previous' = the last snapshot in this session) instead of the full extraction — added/removed/changed nodes plus the behavior observed in between. | |
| visible_only | No | Skip hidden nodes entirely. | |
| include_hidden | No | Keep hidden nodes flagged rather than dropping them. | |
| include_tables | No | Attach structured `tables` (headers, row identity, cells) and `dialogs` (label/value fields) inside the scope, for value assertions. | |
| max_output_chars | No | Budget for the node list; nodes past it are dropped in document order and counted in `omitted` (never silent). | |
| include_click_targets | No | Opt-in heuristic: also include cursor:pointer elements with content that match no other rule (JS-click product cards without anchors/roles/test-ids). Heuristic nodes carry a context_note. |