Home > Blockchain >  Puppeteer Change CSS to all Selectors
Puppeteer Change CSS to all Selectors

Time:04-12

Now Puppeteer change only an first element, but I need to change at all selectors.

let textContent = await page.$('td[style="visibility:hidden"]');
await textContent.evaluate((el) => el.style.visibility = 'visible');

this work only on first element

CodePudding user response:

You should use page.$$ instead

let elements = await page.$$('td[style="visibility:hidden"]');
for(const element of elements) {
  await element.evaluate((el) => el.style.visibility = 'visible');
}
  • Related