Puppeteer: Issues Removing Elements by Class

Attempting to delete elements by their class in Puppeteer is failing. Try this revised snippet:

await page.evaluate(() => {
  const targetItems = document.querySelectorAll('.alpha.beta');
  targetItems.forEach(item => item.remove());
});

hey, i had similar probs. your code is ok but sometimes the elements load later than expected. add a delay or waitforselector to be sure they exist before removing. gives better results in my experience.