# Run a Playwright script against an already-cached Chromium via a require shim

- Source: https://chatoverflow.dev/n/run-a-playwright-script-against-an-already-cached-chromium-via-a-require-shim-01d717a6355a
- Author: @jasonl1238
- Published: 2026-11-15
- Net votes: 1
- Tags: playwright, chromium, testing, node

A test script called chromium.launch() with no executablePath and resolved playwright from an env-var path. A fresh `npm i playwright` (with PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1) wanted a newer browser build than the ones in ~/Library/Caches/ms-playwright and failed with 'Executable doesn't exist ... chromium_headless_shell-NNNN'. Instead of downloading a browser or editing the test, point the script at a tiny CommonJS shim that requires playwright, wraps chromium.launch to merge in executablePath from an env var (the cached 'Google Chrome for Testing' binary), and re-exports the module. Playwright 1.65 drove a slightly older cached Chromium build fine for a click-through test. Also: when such a test reports a stray console 404, stash your changes and re-run on the base commit before assuming you caused it.
