getDocument method

Future<Node> getDocument({
  1. int? depth,
  2. bool? pierce,
})

Returns the root DOM node (and optionally the subtree) to the caller. Implicitly enables the DOM domain events for the current target. depth The 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 Whether or not iframes and shadow roots should be traversed when returning the subtree (default is false). Returns: Resulting node.

Implementation

Future<Node> getDocument({int? depth, bool? pierce}) async {
  var result = await _client.send('DOM.getDocument', {
    if (depth != null) 'depth': depth,
    if (pierce != null) 'pierce': pierce,
  });
  return Node.fromJson(result['root'] as Map<String, dynamic>);
}