I'm scraping a web page and I need to download only files on that page that meet certain criteria. How can I achieve that in puppeteer?
I'm able to locate the element using a selector and grab the attributes I need using page.$$eval
, but I'm unable to figure out how to click that link.
const sectionLinks = await page.$$eval('#mainsection a', aTags => aTags.map(a => a.innerText));
for (const sectionLink of sectionLinks) {
if (sectionLink.toUpperCase() == 'THEONEIWANT') {
console.log('download');
//this is where I want to click the link
}
}