Skip to main content
Version: 1.15

Browsers

Each version of Playwright needs specific versions of browser binaries to operate. Depending on the language you use, Playwright will either download these browsers at package install time for you, or you will need to use Playwright CLI to install these browsers.

With every release, Playwright updates the versions of the browsers it supports, so that the latest Playwright would support the latest browsers at any moment. It means that every time you update playwright, you might need to re-run the install CLI command.

Chromium#

For Google Chrome, Microsoft Edge and other Chromium-based browsers, by default, Playwright uses open source Chromium builds. Since Chromium project is ahead of the branded browsers, when the world is on Google Chrome N, Playwright already supports Chromium N+1 that will be released in Google Chrome and Microsoft Edge in a few weeks.

There is also a way to opt into using Google Chrome's or Microsoft Edge's branded builds for testing. For details on when to opt into stable channels, refer to the Google Chrome & Microsoft Edge section below.

Firefox#

Playwright's Firefox version matches the recent Firefox Stable build.

WebKit#

Playwright's WebKit version matches the recent WebKit trunk build, before it is used in Apple Safari and other WebKit-based browsers. This gives a lot of lead time to react on the potential browser update issues.

Google Chrome & Microsoft Edge#

While Playwright can download and use the recent Chromium build, it can operate against the stock Google Chrome and Microsoft Edge browsers available on the machine. In particular, current Playwright version will support Stable and Beta channels of these browsers. Here is how you can opt into using the stock browser:

import { PlaywrightTestConfig } from '@playwright/test';const config: PlaywrightTestConfig = {  use: {    channel: 'chrome',  },};export default config;

When to use Google Chrome & Microsoft Edge and when not to?#

Defaults

Using default Playwright configuration with the latest Chromium is a good idea most of the time. Since Playwright is ahead of Stable channels for the browsers, it gives peace of mind that the upcoming Google Chrome or Microsoft Edge releases won't break your site. You catch breakage early and have a lot of time to fix it before the official Chrome update.

Regression testing

Having said that, testing policies often require regression testing to be performed against the current publicly available browsers. In this case, you can opt into one of the stable channels, "chrome" or "msedge".

Media codecs

Another reason for testing using official binaries is to test functionality related to media codecs. Chromium does not have all the codecs that Google Chrome or Microsoft Edge are bundling due to various licensing considerations and agreements. If your site relies on this kind of codecs (which is rarely the case), you also want to use official channel.

Enterprise policy

Google Chrome and Microsoft Edge respect enterprise policies, which include limitations to the capabilities, network proxy, mandatory extensions that stand in the way of testing. So if you are a part of the organization that uses such policies, it is the easiest to use bundled Chromium for your local testing, you can still opt into stable channels on the bots that are typically free of such restrictions.

Installing browsers#

Managing browser binaries#

Playwright downloads Chromium, WebKit and Firefox browsers into the OS-specific cache folders:

  • %USERPROFILE%\AppData\Local\ms-playwright on Windows
  • ~/Library/Caches/ms-playwright on MacOS
  • ~/.cache/ms-playwright on Linux

These browsers will take a few hundred megabytes of disk space when installed:

du -hs ~/Library/Caches/ms-playwright/*281M  chromium-XXXXXX187M  firefox-XXXX180M  webkit-XXXX

You can override default behavior using environment variables. When installing Playwright, ask it to download browsers into a specific location:

# Linux/macOSPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install
# Windows with cmd.exeset PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsersnpx playwright install
# Windows with PowerShell$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"npx playwright install

When running Playwright scripts, ask it to search for browsers in a shared location.

# Linux/macOSPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright test
# Windows with cmd.exeset PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsersnpx playwright test
# Windows with PowerShell$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"npx playwright test

Playwright keeps track of packages that need those browsers and will garbage collect them as you update Playwright to the newer versions.

note

Developers can opt-in in this mode via exporting PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers in their .bashrc.

Managing browser binaries#

  • lang: js

You can opt into the hermetic install and place binaries in the local folder:

# Linux/macOS# Places binaries to node_modules/@playwright/testPLAYWRIGHT_BROWSERS_PATH=0 npx playwright install
# Windows with cmd.exe# Places binaries to node_modules\@playwright\testset PLAYWRIGHT_BROWSERS_PATH=0npx playwright install
# Windows with PowerShell# Places binaries to node_modules\@playwright\test$env:PLAYWRIGHT_BROWSERS_PATH=0npx playwright install

Install behind a firewall or a proxy#

By default, Playwright downloads browsers from Microsoft CDN.

Sometimes companies maintain an internal proxy that blocks direct access to the public resources. In this case, Playwright can be configured to download browsers via a proxy server.

Download from artifact repository#

By default, Playwright downloads browsers from Microsoft CDN.

Sometimes companies maintain an internal artifact repository to host browser binaries. In this case, Playwright can be configured to download from a custom location using the PLAYWRIGHT_DOWNLOAD_HOST env variable.

It is also possible to use a per-browser download hosts using PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST, PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST and PLAYWRIGHT_WEBKIT_DOWNLOAD_HOST env variables that take precedence over PLAYWRIGHT_DOWNLOAD_HOST.

Skip browser downloads#

In certain cases, it is desired to avoid browser downloads altogether because browser binaries are managed separately.

This can be done by setting PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD variable before installation.

Stale browser removal#

Playwright keeps track of the clients that use its browsers. When there are no more clients that require particular version of the browser, that version is deleted from the system. That way you can safely use Playwright instances of different versions and at the same time, you don't waste disk space for the browsers that are no longer in use.

To opt-out from the unused browser removal, you can set the PLAYWRIGHT_SKIP_BROWSER_GC=1 environment variable.