list_images method

Future<Online> list_images()

List images

Implementation

Future<Online> list_images() async {
  Show.action(
      'listing', 'image elements', 'in', (await page).url.clean_url());
  await (await page).waitForSelector('img');
  //return a list of all input elements each as a map of properties
  var elements = await (await page).evaluate('''() => {
    return Array.from(document.querySelectorAll('img')).map((e) => {
     // list all attributes and their values
      return Array.from(e.attributes).reduce((map, attribute) => {
        map[attribute.name] = attribute.value;
        return map;
      }, {});
    });
  }''');
  Show.tree(elements, title: "images");
  return this;
}