feat(mcp): emit structured snapshot in --json responses - #42098
Conversation
| * `name` <[string]> Accessible name of the element, if any. | ||
| * `text` <[string]> Text content of the element, when it is the only child. | ||
| * `children` <[Array]> Child nodes and text fragments. | ||
| * Boolean and value properties for element state flags: `checked`, `disabled`, `expanded`, `active`, `invalid`, `level`, `pressed` and `selected`. |
There was a problem hiding this comment.
* Boolean and value properties for element state flags: `checked`, `disabled`, `expanded`, `active`, `invalid`, `level`, `pressed` and `selected`.
What does this mean? Should it be just a list of boolean/number optional properties one per line?
There was a problem hiding this comment.
We don't want to over-specify this type as it is a subject to change.
| // Note: the resolved frame might differ from the original |frame|. | ||
| // See https://developer.mozilla.org/en-US/docs/Web/API/Document/body for body/frameset explanation. | ||
| // Non-strict, because pages with nested framesets have multiple "frameset" elements. | ||
| const resolved = await progress.race(frame.selectors.callOnSelector(selector || 'body,frameset', { strict: options.strict ?? !!selector, noDefaultPierce: !selector || options.noDefaultPierce }, ({ injected, elements }, ariaOptions) => { |
There was a problem hiding this comment.
do we actually care about framesets here?
There was a problem hiding this comment.
This is a pure parity with the regular snapshot
Add Page.ariaSnapshotJSON and Locator.ariaSnapshotJSON that return the aria snapshot as a free form JSON object. MCP response sections can now carry structured content, so inline snapshots in --json replies are emitted as the node tree instead of YAML text. Fixes: microsoft#42076
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🔴 One failure looks caused by this PRHi, I'm the Playwright bot and I took a first look at the CI failures.
DetailsCaused by this PR
Pre-existing flake / infra
Triaged by the Playwright bot - agent run |
Test results for "MCP"7920 passed, 1284 skipped Merge workflow run. |
|
@microsoft-github-policy-service rerun |
Test results for "tests 1"1 flaky51198 passed, 1188 skipped Merge workflow run. |
Summary
Page.ariaSnapshotJSONandLocator.ariaSnapshotJSONreturning the aria snapshot as a free form JSON object--jsonreplies are emitted as the node tree instead of YAML textFixes #42076