0

I need to remove all script nodes from a page before saving the body of the page. How can I remove all script nodes from a page?

hardkoded
  • 18,915
  • 3
  • 52
  • 64
frosty
  • 2,421
  • 6
  • 26
  • 47

1 Answers1

1

You can do something like this:

await page.EvaluateExpressionAsync("document.querySelectorAll('SCRIPT').forEach(e => e.remove())");
hardkoded
  • 18,915
  • 3
  • 52
  • 64