Browsers
Introduction
Each version of Playwright needs specific versions of browser binaries to operate. You will need to use the 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.
Install browsers
Playwright can install supported browsers. Running the command without arguments will install the default browsers.
playwright install
You can also install specific browsers by providing an argument:
playwright install webkit
See all supported browsers:
playwright install --help
Install system dependencies
System dependencies can get installed automatically. This is useful for CI environments.
playwright install-deps
You can also install the dependencies for a single browser by passing it as an argument:
playwright install-deps chromium
It's also possible to combine install-deps with install so that the browsers and OS dependencies are installed with a single command.
playwright install --with-deps chromium
See system requirements for officially supported operating systems.
Configure Browsers
Playwright can run tests on Chromium, WebKit and Firefox browsers as well as branded browsers such as Google Chrome and Microsoft Edge. It can also run on emulated tablet and mobile devices. See the registry of device parameters for a complete list of selected desktop, tablet and mobile devices.
Run tests on different browsers
Run tests on a specific browser:
pytest test_login.py --browser webkit
Run tests on multiple browsers:
pytest test_login.py --browser webkit --browser firefox
Test against mobile viewports:
pytest test_login.py --device="iPhone 13"
Test against branded browsers:
pytest test_login.py --browser-channel msedge
Chromium
For Google Chrome, Microsoft Edge and other Chromium-based browsers, by default, Playwright uses open source Chromium builds. Since the 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 a few weeks later.
Chromium: headless shell
Playwright ships a regular Chromium build for headed operations and a separate chromium headless shell for headless mode.
If you are only running tests in headless shell (i.e. the channel option is not specified), for example on CI, you can avoid downloading the full Chromium browser by passing --only-shell during installation.
# only running tests headlessly
playwright install --with-deps --only-shell
Chromium: new headless mode
You can opt into the new headless mode by using 'chromium' channel. As official Chrome documentation puts it:
New Headless on the other hand is the real Chrome browser, and is thus more authentic, reliable, and offers more features. This makes it more suitable for high-accuracy end-to-end web app testing or browser extension testing.
See issue #33566 for details.
pytest test_login.py --browser-channel chromium
With the new headless mode, you can skip downloading the headless shell during browser installation by using the --no-shell option:
# only running tests headlessly
playwright install