list_buttons method
List buttons List all button elements and their attributes for the current page
Implementation
Future<Online> list_buttons() async {
Show.action(
'listing', 'button elements', 'in', (await page).url.clean_url());
await (await page).waitForSelector('button');
//return a list of all input elements each as a map of properties
var elements = await (await page).evaluate('''() => {
return Array.from(document.querySelectorAll('button')).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: "buttons");
return this;
}