Back to Top

Disabling JavaScript Using Puppeteer

Updated 1 May 2019

JavaScript can be disabled using Puppeteer. We just need to obstruct requests and block loading if the type of id is “script” . Below is the code for disabling javascript from Puppeteer.

const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.setRequestInterception(true);
  page.on('request', request => {
    if (request.resourceType() === 'script')
  await page.goto('');
  await page.screenshot({path: 'webkul.png'});

  await browser.close();

The webkul.png will look like below image in which javascript is disabled.


Thanks for reading this blog!

Happy Testing 🙂

Start your headless eCommerce
Find out More
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


  • Smith
    • Priya Singh (Moderator)
  • Parabjot
    • Garima Pathak (Moderator)
  • Parabjot
  • Kapil Kumar
    • Garima Pathak (Moderator)
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home