Home  Puppeteer   How to disa ...

How to disable caching in puppeteer

To disable caching in Puppeteer, you can use the setCacheEnabled method available on the Page class. Here’s how you can modify your Puppeteer script to disable caching:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();

  // Disable cache
  await page.setCacheEnabled(false);

  // Navigate to a website
  await page.goto('https://example.com');

  // Your Puppeteer script continues here

  await browser.close();
})();

Explanation:

Published on: Jun 28, 2024, 12:25 AM  
 

Comments

Add your comment