Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The right cache depends on what you want to reuse. Browser automation has three separate mechanisms: a framework-managed download cache for browser and driver binaries, the browser’s HTTP response cache, and saved browser storage such as cookies and local storage. Configure them independently. Reusing downloaded binaries makes CI setup more reliable; HTTP caching changes page-load behavior; saved storage reuses a session. None is a substitute for the others.

This guide shows the documented locations and controls for Playwright, Puppeteer, and Selenium Manager, explains Playwright’s routing caveat, and provides safe patterns for CI and authenticated tests.

Choose the cache you actually need

Mechanism What it retains Typical scope Use it for Do not confuse it with
Framework download cache Browser binaries or WebDriver assets A machine or CI cache directory Avoiding a download on every job Cached page responses
Browser HTTP cache HTTP responses such as scripts, stylesheets and images A browser profile or context Testing repeat visits and realistic network behavior Saved login state
Storage state Cookies, local storage and optionally IndexedDB A Playwright context and exported state file Starting tests already signed in HTTP response caching

Start by naming the retained data in your test plan. A binary cache can be restored before the framework starts. An HTTP cache must be allowed to operate during navigation. A state file must be protected like a credential because it can contain session tokens.

How do I cache Playwright browsers in CI?

Playwright’s documented defaults are %USERPROFILE%AppDataLocalms-playwright on Windows, ~/Library/Caches/ms-playwright on macOS, and ~/.cache/ms-playwright on Linux. Set PLAYWRIGHT_BROWSERS_PATH when you want a stable location that your CI provider can save and restore. The cache feature itself is supplied by your CI platform; the path is supplied by Playwright.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

1. Pick and expose a cache directory

Use a job-level environment variable so every step refers to the same directory. For example, on Linux:

export PLAYWRIGHT_BROWSERS_PATH="$HOME/.cache/ms-playwright"

On Windows PowerShell:

$env:PLAYWRIGHT_BROWSERS_PATH = "$env:USERPROFILEAppDataLocalms-playwright"

Install the browsers after restoring the CI cache:

npx playwright install

If the required revision is already present, Playwright can use it without downloading it again. Keep the install command in the job: it also repairs a partial or stale cache.

2. Cache with your CI provider

  1. Restore a cache key that includes the operating system, CPU architecture where relevant, and the Playwright version (or lockfile hash).
  2. Set PLAYWRIGHT_BROWSERS_PATH to the directory represented by that key.
  3. Run npx playwright install and your tests.
  4. Save the directory after the job if the cache was missing or changed.

Do not assume one cache is portable across operating systems or incompatible Playwright revisions. A key that is too broad can restore binaries that the current package does not expect; a key that is too narrow merely causes more downloads.

3. Validate the restored cache

  • Print the resolved Playwright package version in the job.
  • Run a small launch-and-navigate smoke test before the full suite.
  • When a browser executable is missing, run npx playwright install and inspect permissions on the cache directory.

Playwright documents the path and environment-variable behavior in its browser installation guide.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Where does Puppeteer store downloaded browsers?

Puppeteer’s troubleshooting documentation says that, starting with version 19.0.0, downloaded browsers go to ~/.cache/puppeteer by default. Check your installed version before relying on that boundary. You can change the directory with PUPPETEER_CACHE_DIR:

export PUPPETEER_CACHE_DIR="$HOME/.cache/puppeteer"

For a repository configuration, use a .puppeteerrc.js (or puppeteer.config.js) file:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
module.exports = {
  cacheDirectory: '/home/runner/.cache/puppeteer'
};

After changing this configuration, Puppeteer’s documentation says you must reinstall Puppeteer for the change to take effect. In CI, restore the directory before installation, run the install, and cache the resulting directory using a key tied to the Puppeteer version and lockfile.

Puppeteer cache checklist

  • Confirm the installed version with your package manager.
  • Use an absolute, writable directory for PUPPETEER_CACHE_DIR or cacheDirectory.
  • Reinstall after changing cacheDirectory.
  • Separate caches for different operating systems and architectures.
  • Keep the install step so missing revisions are downloaded automatically.

See the official Puppeteer troubleshooting guide for the version-specific behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I cache Selenium drivers?

Selenium Manager’s documented local cache is ~/.cache/selenium. It stores downloaded browser and driver assets and also contains se-config.toml and se-metadata.json. The metadata records discovered versions and a TTL. That TTL describes metadata freshness; it is not a universal offline guarantee for every Selenium setup.

Make the Selenium cache available to a job

  1. Persist ~/.cache/selenium between jobs with your CI provider.
  2. Use a cache key that includes the operating system, architecture, browser choice and Selenium-related dependency versions.
  3. Allow Selenium Manager to resolve the browser and driver normally.
  4. If resolution fails, remove only the affected cache entry and rerun so Selenium Manager can discover and download current assets.

A restored cache can reduce repeated downloads, but driver discovery still depends on the browser installed in that environment and on Selenium Manager’s current resolution rules. Read the Selenium Manager documentation when diagnosing a mismatch.

How browser HTTP caching behaves in Playwright

Downloaded binaries are not page resources. To test HTTP caching, use a normal browser context and make repeated navigations under the same context. The first visit can populate the browser cache; a later visit may reuse responses according to the site’s cache headers and browser rules.

Why is my browser cache disabled when I use Playwright routes?

Playwright’s BrowserContext documentation states: “Enabling routing disables http cache.” A route used to mock, inspect or block requests changes the condition being tested. If your goal is authentic cache behavior, do not enable routing for that test, or split the test into a routed test for interception behavior and an unrouted test for cache behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
import { chromium } from 'playwright';

const browser = await chromium.launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://example.com');
await page.reload();
await browser.close();

When you do need routing, document that the test no longer represents a browser with HTTP cache enabled. Do not generalize this Playwright behavior to every automation framework.

Design an HTTP-cache test

  • Use the same context for the first and subsequent navigations.
  • Record request and response headers so you can see whether the server permits reuse.
  • Do not mix request routing with the assertion about browser-cache behavior.
  • Use a controlled test origin when you need deterministic cache headers and content.

Reuse cookies and local storage with Playwright storage state

Storage state is session reuse, not response caching. Playwright can export cookies and local storage with browserContext.storageState(), then initialize a new context from that file. IndexedDB can be included when your application stores authentication or other state there.

Save state after signing in

import { chromium } from 'playwright';

const browser = await chromium.launch();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://example.com/login');
// Complete the application's login flow here.
await context.storageState({ path: 'playwright/.auth/user.json', indexedDB: true });
await browser.close();

Initialize a later context from state

import { chromium } from 'playwright';

const browser = await chromium.launch();
const context = await browser.newContext({
  storageState: 'playwright/.auth/user.json'
});
const page = await context.newPage();
await page.goto('https://example.com/account');
await browser.close();

The Browser API and API testing guide document these patterns. Store state files outside public repositories, restrict filesystem permissions, and provide a fresh state file to CI through a secret or protected artifact. Delete or rotate it when the account is revoked.

Cache configuration in a repeatable CI workflow

  1. Lock versions. Commit the package lockfile and include its hash in the cache key.
  2. Separate cache types. Keep browser binaries, HTTP-cache test data and authentication state in different locations and lifecycle policies.
  3. Restore before install. Restore the framework directory, then run the framework’s install or repair command.
  4. Verify the environment. Launch the browser, navigate to a health page and report the framework version.
  5. Invalidate deliberately. Change the key when the framework revision, operating system image or browser channel changes.
  6. Protect credentials. Never publish storage-state files as ordinary build artifacts.

For parallel jobs, use read-only restored caches where possible. Let one job create a new cache rather than allowing many jobs to overwrite the same directory. A cache miss should be a slower setup, not a test failure; your install step is the recovery path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshooting common failures

“Executable doesn’t exist” or browser launch failure

Cause: the cache path is empty, incomplete or points to a different framework revision. Fix: print the path, check permissions, restore a version-specific key and run the framework install command again.

Every CI run downloads browsers

Cause: the CI cache is not being saved, the key changes on every run, or the framework is using a different path than the one cached. Fix: set the documented path explicitly and inspect cache restore/save logs.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Puppeteer ignores cacheDirectory

Cause: Puppeteer was not reinstalled after the configuration changed. Fix: reinstall it, then confirm the new directory contains the downloaded revision.

Selenium reports a driver/browser mismatch

Cause: cached assets or metadata no longer match the browser in the runner image. Fix: use a key containing the browser and image version, remove the stale entry and allow Selenium Manager to resolve again.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A routed Playwright test appears to miss the HTTP cache

Cause: routing disables HTTP cache in that context. Fix: remove routing for the cache-fidelity test or separate interception assertions from cache assertions.

A supposedly logged-in context is anonymous

Cause: the state file lacks the needed cookie, local-storage entry or IndexedDB data, or it has expired. Fix: regenerate state after login, request indexedDB: true when required, and verify the file is readable by the test user.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability and cost considerations

Official documentation reviewed for these frameworks does not provide a universal percentage or time saving from caching, so measure your own pipeline. Record cold-install and warm-cache durations, cache size, hit rate and failure-recovery time. Large browser directories can make cache upload and restore slower than a fresh download on a fast runner.

Use retention limits appropriate to your CI provider, and periodically rebuild caches rather than preserving unbounded revisions. Keep HTTP-cache tests deterministic with controlled origins, while production-like tests should use the same routing and context behavior as the application under test.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Or skip the browser setup

If you only need a clean image or PDF of a URL rather than an interactive browser session, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP or PDF. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

cURL:

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

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

See the ScreenshotNeo documentation for authentication and options. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. The service offers full-page and element captures, device and viewport controls, custom CSS and JavaScript, waits, blocking rules, headers, cookies, user agents, timezone and geolocation, resizing, selectable-TTL caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Parameter names used by other screenshot APIs also work.

Plan Allowance Price
Free 1,000 shots/month No card
Starter 3,000 shots $5
Growth 15,000 shots $15
Pro 60,000 shots $39
Scale 250,000 shots $99
Business 1,000,000 shots $249

Every feature is available on every plan; yearly billing gives two months free. Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card, or use a paid plan starting at $5 for 3,000.

Frequently Asked Questions

Can I share one browser download cache between Playwright and Puppeteer?

No. Their cache directories, revision management and configuration controls are framework-specific. Keep separate, versioned directories.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does storage state restore a browser’s image and script cache?

No. Storage state restores cookies, local storage and optionally IndexedDB. HTTP responses are governed by the browser context and server cache headers.

Should a CI cache contain authentication state?

Only in a protected, access-controlled mechanism. Treat exported state as a secret and never commit it to a public repository.

Is Selenium’s cache TTL a test-cache expiry setting?

Selenium Manager’s metadata includes a TTL for discovered-version information. It is not a universal expiry rule for every browser, driver or CI cache.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.