How to disable JavaScript on a page in Puppeteer?

You can disable JavaScript on a page in Puppeteer by using the setJavaScriptEnabled method on the Page object. Here's an example on how to disable JavaScript on a page:

const puppeteer = require('puppeteer'); (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); // Disable JavaScript on the page await page.setJavaScriptEnabled(false); await page.goto('https://example.com'); // Do something on the page await browser.close(); })();

In this example, the setJavaScriptEnabled(false) method is called on the page object to disable JavaScript on the page. This means that any JavaScript code on the page will not be executed.