ScreenshotNeo

BlogHow-to

How to Clear Puppeteer’s Browser Cache

Choose the right Puppeteer cache operation: bypass cache for every request, one reload, or a fresh isolated context.

By the ScreenshotNeo team4 October 20265 min read

To make a Puppeteer page ignore cached resources on its requests, call await page.setCacheEnabled(false). For a single reload, use await page.reload({ ignoreCache: true }). For a clean, isolated session, create a new browser context; contexts do not share cookies or cache. These choices affect different scopes, and none should be confused with clearing Puppeteer’s downloaded browser binaries.

1. Pick the cache operation for your need

What you need Use Scope
Have page requests ignore cache page.setCacheEnabled(false) Page request behavior until re-enabled
Bypass cache for one reload page.reload({ ignoreCache: true }) That reload
Start an isolated session browser.createBrowserContext() New context with separate cookies and cache
Remove downloaded browser installations npx @puppeteer/browsers clear Installed browser binaries, not website resources

Puppeteer documents cache as enabled by default. setCacheEnabled(false) makes requests ignore it; the API does not promise to erase all previously stored browser data. See the Page.setCacheEnabled API and ReloadOptions API.

2. Ignore cache for page requests

Use this when a navigation and subsequent requests from the page should fetch without using cache. Set it before navigating:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.setCacheEnabled(false);
    await page.goto('https://example.com', { waitUntil: 'networkidle2' });
    await page.screenshot({ path: 'fresh-page.png', fullPage: true });
  } finally {
    await browser.close();
  }
})();

To restore normal cache use on that page, call await page.setCacheEnabled(true). If you disable cache after navigation, it affects later requests; reload or navigate after changing the setting when the page’s existing resources need to be fetched again.

3. Ignore cache for just one reload

When the page is already open and you want one fresh reload without changing the cache setting for later requests, pass ignoreCache: true:

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com');
    await page.reload({ ignoreCache: true, waitUntil: 'networkidle2' });
    await page.screenshot({ path: 'reloaded.png', fullPage: true });
  } finally {
    await browser.close();
  }
})();

The option applies to that reload. For repeat navigations that should ignore cache, use setCacheEnabled(false). Refer to Puppeteer’s reload options.

4. Use a separate browser context for an isolated session

A newly created context does not share cookies or cache with other contexts. This gives a separate session; it does not erase data from another context. Close the context when finished, which also closes its pages.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch();
  const context = await browser.createBrowserContext();
  try {
    const page = await context.newPage();
    await page.goto('https://example.com', { waitUntil: 'networkidle2' });
    await page.screenshot({ path: 'isolated-session.png', fullPage: true });
  } finally {
    await context.close();
    await browser.close();
  }
})();

Use this when each job needs an independent browser session, such as separate users or test cases. See Browser.createBrowserContext and the browser management guide.

5. Keep browser downloads separate from page cache

npx @puppeteer/browsers clear clears installed browser binaries. It does not clear a website’s HTTP or resource cache. Likewise, Puppeteer’s cacheDirectory setting and PUPPETEER_CACHE_DIR environment variable select where downloaded browsers are stored; changing that directory does not clear a page cache. See the @puppeteer/browsers documentation and Puppeteer configuration reference.

6. ScreenshotNeo: capture a page without browser setup

If your goal is simply to get a current screenshot, ScreenshotNeo provides a screenshot API and MCP server. Its request accepts a URL and returns an image or PDF. The API supports screenshot parameters used by other screenshot APIs, which can make switching easier. See the ScreenshotNeo API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
    timeout=90,
)
r.raise_for_status()
with open("shot.webp", "wb") as f:
    f.write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://example.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo accepts cookie and consent banners as a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing status. Its MCP server includes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.

Sign up for 1,000 free screenshots a month, with no card required.

7. Troubleshooting

Symptom Likely cause Fix
The screenshot still shows old content Cache was disabled after the relevant resources had already loaded, or the page was not reloaded. Set setCacheEnabled(false) before navigation, then navigate or reload.
Only one navigation is fresh ignoreCache: true was used on a single reload. Disable cache with setCacheEnabled(false) before the requests that should bypass it.
Cookies or login state are missing A new browser context intentionally does not share cookies with other contexts. Use the context that owns the session, or explicitly establish the required session in the new context.
The Puppeteer clear command removed a browser npx @puppeteer/browsers clear manages downloaded browser binaries. Reinstall the browser binary as needed; use page cache controls for site resources.
The page still serves stale content with cache disabled The site, service worker, proxy, CDN, or application may independently provide cached data. Check response headers and the application’s service worker or upstream cache policy. Puppeteer’s page setting controls browser request cache behavior; it does not guarantee invalidation of external caches.

8. Performance, reliability, and cost

Ignoring cache can increase network requests and page load time because reusable resources must be fetched again. It is useful for freshness checks and debugging, but normal cache behavior is usually more efficient for repeated captures. A fresh context provides session isolation and separate context cache, but incurs the work of setting up that context and any required login state. Puppeteer itself does not charge per screenshot; compute, bandwidth, and any browser infrastructure you operate determine your costs. ScreenshotNeo’s published plans are Free: 1,000 shots/month, Starter: $5 for 3,000, Growth: $15 for 15,000, Pro: $39 for 60,000, Scale: $99 for 250,000, and Business: $249 for 1,000,000; yearly billing gives two months free, and every feature is on every plan.

9. FAQ

Does disabling cache delete cached files?

The documented behavior is that requests ignore cache. The API does not state that it deletes all previously stored browser data.

Should I use a new page or a new context?

A new page is enough when you only need another tab within the same session. Use a new context when cookies and cache need isolation from other contexts.

Do these APIs differ by Puppeteer version?

They are documented in the Puppeteer 25.12.0 API references cited above. Check the reference matching the version installed in your project if your method signature or behavior differs.

Does clearing Puppeteer’s browser download directory clear websites’ cache?

No. Browser download storage and page resource caching are separate concerns.