← Back to DOMSnapshot domain
DOMSnapshot.getSnapshot
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
deprecated
Parameters
| Name | Type | Description |
computedStyleWhitelist | array | Whitelist of computed styles to return. |
includeEventListeners (optional) | boolean | Whether or not to retrieve details of DOM listeners (default false). |
includePaintOrder (optional) | boolean | Whether to determine and include the paint order index of LayoutTreeNodes (default false). |
includeUserAgentShadowTree (optional) | boolean | Whether to include UA shadow tree in the snapshot (default false). |
Returns
| Name | Type | Description |
domNodes | array | The nodes in the DOM tree. The DOMNode at index 0 corresponds to the root document. |
layoutTreeNodes | array | The nodes in the layout tree. |
computedStyles | array | Whitelisted ComputedStyle properties for each node in the layout tree. |
Example Request
{
"id": 1,
"method": "DOMSnapshot.getSnapshot",
"params": {
"computedStyleWhitelist": []
}
}
Example Response
{
"id": 1,
"result": {
"domNodes": [],
"layoutTreeNodes": [],
"computedStyles": []
}
}
Usage in Node.js
const result = await send('DOMSnapshot.getSnapshot', {"computedStyleWhitelist": []});
console.log(result);
// {"domNodes": [], "layoutTreeNodes": [], "computedStyles": []}