getFlattenedDocument method

  1. @Deprecated('Use DOMSnapshot.captureSnapshot instead')
Future<List<Node>> getFlattenedDocument({
  1. int? depth,
  2. bool? pierce,
})

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. 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

@Deprecated('Use DOMSnapshot.captureSnapshot instead')
Future<List<Node>> getFlattenedDocument({int? depth, bool? pierce}) async {
  var result = await _client.send('DOM.getFlattenedDocument', {
    if (depth != null) 'depth': depth,
    if (pierce != null) 'pierce': pierce,
  });
  return (result['nodes'] as List)
      .map((e) => Node.fromJson(e as Map<String, dynamic>))
      .toList();
}