← Back to DOM domain

DOM.getFlattenedDocument

Returns the root DOM node (and optionally the subtree) to the caller. Deprecated, as it is not designed to work well with the rest of the DOM agent. Use DOMSnapshot.captureSnapshot instead.

Domain: DOM deprecated

Parameters

NameTypeDescription
depth (optional)integerThe maximum depth at which children should be retrieved, defaults to 1. Use -1 for the entire subtree or provide an integer larger than 0.
pierce (optional)booleanWhether or not iframes and shadow roots should be traversed when returning the subtree (default is false).

Returns

NameTypeDescription
nodesarrayResulting node.

Example Request

{
  "id": 1,
  "method": "DOM.getFlattenedDocument"
}

Example Response

{
  "id": 1,
  "result": {
    "nodes": []
  }
}

Usage in Node.js

const result = await send('DOM.getFlattenedDocument');
console.log(result);
// {"nodes": []}