You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/api/class-locator.md
+55Lines changed: 55 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -239,6 +239,61 @@ When `true`, appends each element's bounding box as `[box=x,y,width,height]` to
239
239
relative to the viewport, in CSS pixels, as returned by [`Element.getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).
240
240
Defaults to `false`.
241
241
242
+
## async method: Locator.ariaSnapshotJSON
243
+
* since: v1.63
244
+
* langs: js
245
+
- returns: <[Serializable]>
246
+
247
+
Captures the aria snapshot of the given element as a free form JSON object.
248
+
249
+
**Usage**
250
+
251
+
```js
252
+
await page.getByRole('list').ariaSnapshotJSON();
253
+
```
254
+
255
+
**Details**
256
+
257
+
This method returns the same tree as [`method: Locator.ariaSnapshot`], serialized as a JSON value instead of YAML markup.
258
+
The result is a list of nodes, each node being either a plain string with static text, or an object with the following properties:
259
+
* `role` <[string]> Aria role of the element.
260
+
* `name` <[string]> Accessible name of the element, if any.
261
+
* `text` <[string]> Text content of the element, when it is the only child.
262
+
* `children` <[Array]> Child nodes and text fragments.
263
+
* Boolean and value properties for element state flags: `checked`, `disabled`, `expanded`, `active`, `invalid`, `level`, `pressed` and `selected`.
264
+
* Additional element properties, for example `url` for links and `placeholder` for text boxes.
265
+
* `ref` <[string]> Element reference for AI-optimized snapshots.
266
+
* `cursor` <[string]> Set to `"pointer"` for clickable elements in AI-optimized snapshots.
267
+
* `box` <[Object]> Bounding box of the element when [`option: Locator.ariaSnapshotJSON.boxes`] is set.
268
+
269
+
### option: Locator.ariaSnapshotJSON.mode
270
+
* since: v1.63
271
+
- `mode`<[AriaSnapshotMode]<"ai"|"default">>
272
+
273
+
When set to `"ai"`, returns a snapshot optimized for AI consumption. Defaults to `"default"`. See details in [`method: Locator.ariaSnapshot`].
When `true`, includes each element's bounding box as a `box` property with `x`, `y`, `width` and `height`. Coordinates are
294
+
relative to the viewport, in CSS pixels, as returned by [`Element.getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).
Copy file name to clipboardExpand all lines: docs/src/api/class-page.md
+37Lines changed: 37 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4427,6 +4427,43 @@ When `true`, appends each element's bounding box as `[box=x,y,width,height]` to
4427
4427
relative to the viewport, in CSS pixels, as returned by [`Element.getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).
4428
4428
Defaults to `false`.
4429
4429
4430
+
## async method: Page.ariaSnapshotJSON
4431
+
* since: v1.63
4432
+
* langs: js
4433
+
- returns: <[Serializable]>
4434
+
4435
+
Captures the aria snapshot of the page as a free form JSON object.
4436
+
Returns the same tree as [`method: Page.ariaSnapshot`], serialized as a JSON value instead of YAML markup.
4437
+
See [`method: Locator.ariaSnapshotJSON`] for the details of the format.
4438
+
4439
+
### option: Page.ariaSnapshotJSON.mode
4440
+
* since: v1.63
4441
+
-`mode` <[AriaSnapshotMode]<"ai"|"default">>
4442
+
4443
+
When set to `"ai"`, returns a snapshot optimized for AI consumption: including element references like `[ref=e2]` and snapshots of `<iframe>`s. Defaults to `"default"`.
When `true`, includes each element's bounding box as a `box` property with `x`, `y`, `width` and `height`. Coordinates are
4464
+
relative to the viewport, in CSS pixels, as returned by [`Element.getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect).
4465
+
Defaults to `false`.
4466
+
4430
4467
## async method: Page.tap
4431
4468
* since: v1.8
4432
4469
* discouraged: Use locator-based [`method: Locator.tap`] instead. Read more about [locators](../locators.md).
0 commit comments