Environment Variables

NOTE playwright-core does not respect environment variables.

Playwright looks for certain environment variables to aid its operations. If Playwright doesn’t find them in the environment, a lowercased variant of these variables will be used from the npm config.

  • PLAYWRIGHT_DOWNLOAD_HOST - overwrite URL prefix that is used to download browsers. Note: this includes protocol and might even include path prefix. By default, Playwright uses https://storage.googleapis.com to download Chromium and https://playwright.azureedge.net to download Webkit & Firefox. You can also use browser-specific download hosts that superceed the PLAYWRIGHT_DOWNLOAD_HOST variable:
    • PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST - host to specify Chromium downloads
    • PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST - host to specify Firefox downloads
    • PLAYWRIGHT_WEBKIT_DOWNLOAD_HOST - host to specify Webkit downloads
  • PLAYWRIGHT_BROWSERS_PATH - specify a shared folder that playwright will use to download browsers and to look for browsers when launching browser instances.
  • PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD - set to non-empty value to skip browser downloads altogether.
  1. # Linux/macOS
  2. # Install browsers to the shared location.
  3. $ PLAYWRIGHT_BROWSERS_PATH=$HOME/playwright-browsers npm install --save-dev playwright
  4. # Use shared location to find browsers.
  5. $ PLAYWRIGHT_BROWSERS_PATH=$HOME/playwright-browsers node playwright-script.js
  6. # Windows
  7. # Install browsers to the shared location.
  8. $ set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\playwright-browsers
  9. $ npm install --save-dev playwright
  10. # Use shared location to find browsers.
  11. $ set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\playwright-browsers
  12. $ node playwright-script.js