extract_semantic_dom
Navigate to a staging URL and return Semantic JSON of interactive elements with Playwright locators and live state. Use before writing tests so selectors are real, not guessed.
Instructions
Navigate to a staging URL and return factual Semantic JSON of all interactive/test-relevant elements with Playwright-native locators and live state. Use this before writing any Playwright test so selectors are real, not guessed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | The page to extract. Must be http/https and on an allowlisted host. | |
| 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. | |
| viewport | No | Viewport preset — 'mobile' is 375x812 with touch, for responsive states. | desktop |
| wait_for | No | Navigation wait. 'auto' (default) waits for load, then until the DOM has been quiet for 500ms (max 6s) — works on SPAs that render after load and on pages whose analytics never let the network go idle. 'networkidle' times out on such pages. | auto |
| max_nodes | No | Cap on extracted nodes; truncation is flagged, never silent. | |
| visible_only | No | Skip hidden nodes entirely. | |
| wait_selector | No | Optional selector to await before extracting (for SPA content). | |
| 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. |