← Back to DOM domain

DOM.requestChildNodes

Requests that children of the node with given id are returned to the caller in form of `setChildNodes` events where not only immediate children are retrieved, but all children down to the specified depth.

Domain: DOM stable

Parameters

NameTypeDescription
nodeIdNodeIdId of the node to get children for.
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 sub-tree (default is false).

Example Request

{
  "id": 1,
  "method": "DOM.requestChildNodes",
  "params": {
    "nodeId": 1
  }
}

Example Response

{
  "id": 1,
  "result": {}
}

Usage in Node.js

const result = await send('DOM.requestChildNodes', {"nodeId": 1});
console.log(result);