$$ method

Future<List<ElementHandle>> $$(
  1. String selector
)

The method runs element.querySelectorAll within the page. If no elements match the selector, the return value resolves to [].

Implementation

Future<List<ElementHandle>> $$(String selector) async {
  var arrayHandle = await evaluateHandle(
      //language=js
      'function _(element, selector) {return element.querySelectorAll(selector);}',
      args: [selector]);
  var properties = await arrayHandle.properties;
  await arrayHandle.dispose();
  var result = <ElementHandle>[];
  for (var property in properties.values) {
    var elementHandle = property.asElement;
    if (elementHandle != null) result.add(elementHandle);
  }
  return result;
}