← Back to DOMSnapshot domain
DOMSnapshot.captureSnapshot
Returns a document snapshot, including the full DOM tree of the root node (including iframes,
template contents, and imported documents) in a flattened array, as well as layout and
white-listed computed style information for the nodes. Shadow DOM in the returned DOM tree is
flattened.
Domain: DOMSnapshot
experimental
Parameters
| Name | Type | Description |
computedStyles | array | Whitelist of computed styles to return. |
includePaintOrder (optional) | boolean | Whether to include layout object paint orders into the snapshot. |
includeDOMRects (optional) | boolean | Whether to include DOM rectangles (offsetRects, clientRects, scrollRects) into the snapshot |
includeBlendedBackgroundColors (optional) | boolean | Whether to include blended background colors in the snapshot (default: false).
Blended background color is achieved by blending background colors of all elements
that overlap with the current element. |
includeTextColorOpacities (optional) | boolean | Whether to include text color opacity in the snapshot (default: false).
An element might have the opacity property set that affects the text color of the element.
The final text color opacity is computed based on the opacity of all overlapping elements. |
Returns
| Name | Type | Description |
documents | array | The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document. |
strings | array | Shared string table that all string properties refer to with indexes. |
Example Request
{
"id": 1,
"method": "DOMSnapshot.captureSnapshot",
"params": {
"computedStyles": []
}
}
Example Response
{
"id": 1,
"result": {
"documents": [],
"strings": []
}
}
Usage in Node.js
const result = await send('DOMSnapshot.captureSnapshot', {"computedStyles": []});
console.log(result);
// {"documents": [], "strings": []}