2021-03-19 06:35:55 +08:00
---
id: browsers
title: "Browsers"
---
2023-02-28 18:09:44 +01:00
Each version of Playwright needs specific versions of browser binaries to operate. You will need to use the Playwright CLI to install these browsers.
2021-06-09 12:34:58 -07:00
2023-03-07 17:53:12 +01:00
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.
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
## Install browsers
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
Playwright can install supported browsers. Running the command without arguments will install the default browsers.
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
```bash js
npx playwright install
```
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
```bash java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
```
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
```bash python
playwright install
```
2021-05-03 16:52:33 -07:00
2023-02-28 18:09:44 +01:00
```bash csharp
pwsh bin/Debug/netX/playwright.ps1 install
```
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
You can also install specific browsers by providing an argument:
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
```bash js
npx playwright install webkit
```
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
```bash java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install webkit"
```
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
```bash python
playwright install webkit
```
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
```bash csharp
pwsh bin/Debug/netX/playwright.ps1 install webkit
```
2023-01-12 13:12:02 -08:00
2023-02-28 18:09:44 +01:00
See all supported browsers:
```bash js
npx playwright install --help
2021-08-06 14:02:41 -07:00
```
2023-02-28 18:09:44 +01:00
```bash java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --help"
2021-08-06 14:02:41 -07:00
```
2023-02-28 18:09:44 +01:00
```bash python
playwright install --help
2021-03-19 06:35:55 +08:00
```
2023-02-28 18:09:44 +01:00
```bash csharp
pwsh bin/Debug/netX/playwright.ps1 install --help
```
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
### Install browsers via API
* langs: csharp
It's possible to run Command line tools commands via the .NET API:
```csharp
var exitCode = Microsoft.Playwright.Program.Main(new[] {"install"});
if (exitCode != 0)
{
throw new Exception($"Playwright exited with code {exitCode}");
2021-03-19 06:35:55 +08:00
}
```
2023-06-21 14:04:15 +02:00
## Install system dependencies
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
System dependencies can get installed automatically. This is useful for CI environments.
```bash js
npx playwright install-deps
2021-03-19 06:35:55 +08:00
```
2023-02-28 18:09:44 +01:00
```bash java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install-deps"
```
2022-04-19 21:23:26 +03:00
2023-02-28 18:09:44 +01:00
```bash python
playwright install-deps
2021-05-20 08:20:21 -07:00
```
2023-02-28 18:09:44 +01:00
```bash csharp
pwsh bin/Debug/netX/playwright.ps1 install-deps
```
2022-12-28 15:13:45 -08:00
2023-02-28 18:09:44 +01:00
You can also install the dependencies for a single browser by passing it as an argument:
2022-12-28 15:13:45 -08:00
2023-02-28 18:09:44 +01:00
```bash js
npx playwright install-deps chromium
2022-12-28 15:13:45 -08:00
```
2023-02-28 18:09:44 +01:00
```bash java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install-deps chromium"
2022-12-28 15:13:45 -08:00
```
2023-02-28 18:09:44 +01:00
```bash python
playwright install-deps chromium
2022-12-28 15:13:45 -08:00
```
2023-02-28 18:09:44 +01:00
```bash csharp
pwsh bin/Debug/netX/playwright.ps1 install-deps chromium
2022-12-28 15:13:45 -08:00
```
2023-02-28 18:09:44 +01:00
It's also possible to combine `install-deps` with `install` so that the browsers and OS dependencies are installed with a single command.
2022-12-28 15:13:45 -08:00
2023-02-28 18:09:44 +01:00
```bash js
npx playwright install --with-deps chromium
```
2022-12-28 15:13:45 -08:00
2023-02-28 18:09:44 +01:00
```bash java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps chromium"
```
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
```bash python
playwright install --with-deps chromium
```
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
```bash csharp
pwsh bin/Debug/netX/playwright.ps1 install --with-deps chromium
```
2021-03-19 06:35:55 +08:00
2023-06-02 14:13:02 -07:00
See [system requirements ](./intro.md#system-requirements ) for officially supported operating systems.
2023-06-04 12:04:42 -04:00
## Update Playwright regularly
2023-03-07 17:53:12 +01:00
* langs: js
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
By keeping your Playwright version up to date you will be able to use new features and test your app on the latest browser versions and catch failures before the latest browser version is released to the public.
2021-03-19 06:35:55 +08:00
2023-03-07 17:53:12 +01:00
```bash
2023-02-28 18:09:44 +01:00
# Update playwright
npm install -D @playwright/test@latest
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
# Install new browsers
npx playwright install
```
Check the [release notes ](./release-notes.md ) to see what the latest version is and what changes have been released.
2021-03-19 06:35:55 +08:00
2023-03-07 17:53:12 +01:00
```bash
2023-02-28 18:09:44 +01:00
# See what version of Playwright you have by running the following command
npx playwright --version
```
2021-03-19 06:35:55 +08:00
2023-02-28 18:09:44 +01:00
## Configure Browsers
2021-08-06 14:02:41 -07:00
2023-06-02 14:13:02 -07:00
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 ](https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json ) for a complete list of selected desktop, tablet and mobile devices.
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
### Run tests on different browsers
* langs: js
2021-08-06 14:02:41 -07:00
2023-06-02 14:13:02 -07:00
Playwright can run your tests in multiple browsers and configurations by setting up **projects** in the config. You can also add [different options ](./test-configuration ) for each project.
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
```js
import { defineConfig, devices } from '@playwright/test ';
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
export default defineConfig({
projects: [
/* Test against desktop browsers */
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
},
/* Test against mobile viewports. */
{
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
},
/* Test against branded browsers. */
{
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' }, // or 'chrome-beta'
},
{
name: 'Microsoft Edge',
use: { ...devices['Desktop Edge'], channel: 'msedge' }, // or 'msedge-dev'
},
],
});
2021-08-06 14:02:41 -07:00
```
2023-02-28 18:09:44 +01:00
Playwright will run all projects by default.
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
```bash
npx playwright test
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
Running 7 tests using 5 workers
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
✓ [chromium] › example.spec.ts:3:1 › basic test (2s)
✓ [firefox] › example.spec.ts:3:1 › basic test (2s)
✓ [webkit] › example.spec.ts:3:1 › basic test (2s)
✓ [Mobile Chrome] › example.spec.ts:3:1 › basic test (2s)
✓ [Mobile Safari] › example.spec.ts:3:1 › basic test (2s)
✓ [Google Chrome] › example.spec.ts:3:1 › basic test (2s)
✓ [Microsoft Edge] › example.spec.ts:3:1 › basic test (2s)
2021-08-06 14:02:41 -07:00
```
2023-02-28 18:09:44 +01:00
Use the `--project` command line option to run a single project.
2022-07-18 23:39:01 +02:00
2023-02-28 18:09:44 +01:00
```bash
npx playwright test --project=firefox
2022-07-18 23:39:01 +02:00
2023-02-28 18:09:44 +01:00
Running 1 test using 1 worker
✓ [firefox] › example.spec.ts:3:1 › basic test (2s)
2022-07-18 23:39:01 +02:00
```
2023-02-28 18:09:44 +01:00
The VS Code test runner runs your tests on the default browser of Chrome. To run on other/multiple browsers click the play button's dropdown from the testing sidebar and choose another profile or modify the default profile by clicking **Select Default Profile** and select the browsers you wish to run your tests on.
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
< img width = "1464" alt = "selecting browsers" src = "https://user-images.githubusercontent.com/13063165/221136731-9d4bc18f-38a4-4adb-997b-5b98c98aec7f.png" / >
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
Choose a specific profile, various profiles or all profiles to run tests on.
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
< img width = "1536" alt = "choosing default profiles" src = "https://user-images.githubusercontent.com/13063165/221669537-e5df8672-f50d-4ff1-96f9-141cd67e12f8.png" / >
### Run tests on different browsers
* langs: python
Run tests on a specific browser:
2021-08-06 14:02:41 -07:00
```bash
2023-02-28 18:09:44 +01:00
pytest test_login.py --browser webkit
2021-08-06 14:02:41 -07:00
```
2023-02-28 18:09:44 +01:00
Run tests on multiple browsers:
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
```bash
pytest test_login.py --browser webkit --browser firefox
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
Test against mobile viewports:
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
```bash
2023-03-07 17:53:12 +01:00
pytest test_login.py --device="iPhone 13"
2021-08-06 14:02:41 -07:00
```
2023-02-28 18:09:44 +01:00
Test against branded browsers:
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
```bash
pytest test_login.py --browser-channel msedge
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
### Run tests on different browsers
* langs: java
2021-08-06 14:02:41 -07:00
2023-03-07 17:53:12 +01:00
Run tests on a specific browser:
2023-02-28 18:09:44 +01:00
```java
import com.microsoft.playwright.*;
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
public class Example {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
// Launch chromium, firefox or webkit.
Browser browser = playwright.chromium().launch();
Page page = browser.newPage();
// ...
}
}
}
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2023-03-07 17:53:12 +01:00
Run tests on multiple browsers and make it based on the environment variable `BROWSER` :
```java
import com.microsoft.playwright.*;
public class Example {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
Browser browser = null;
String browserName = System.getenv("BROWSER");
if (browserName.equals("chromium")) {
browser = playwright.chromium().launch();
} else if (browserName.equals("firefox")) {
browser = playwright.firefox().launch();
} else if (browserName.equals("webkit")) {
browser = playwright.webkit().launch();
}
Page page = browser.newPage();
// ...
}
}
}
```
2023-02-28 18:09:44 +01:00
### Run tests on different browsers
* langs: csharp
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
Run tests on a specific browser:
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
```bash
dotnet test -- Playwright.BrowserName=webkit
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
To run your test on multiple browsers or configurations you need to invoke the `dotnet test` command multiple times. You can either specify the `BROWSER` environment variable or set the `Playwright.BrowserName` via the runsettings file:
```bash
dotnet test --settings:chromium.runsettings
dotnet test --settings:firefox.runsettings
dotnet test --settings:webkit.runsettings
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
```xml
<?xml version="1.0" encoding="utf-8"?>
< RunSettings >
< Playwright >
< BrowserName > chromium< / BrowserName >
< / Playwright >
< / RunSettings >
2021-08-06 14:02:41 -07:00
```
2023-02-28 18:09:44 +01:00
### Chromium
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
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.
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
### Google Chrome & Microsoft Edge
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
While Playwright can download and use the recent Chromium build, it can operate against the branded Google Chrome and Microsoft Edge browsers available on the machine (note that Playwright doesn't install them by default). In particular, the current Playwright version will support Stable and Beta channels of these browsers.
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
Available channels are `chrome` , `msedge` , `chrome-beta` , `msedge-beta` or `msedge-dev` .
2021-08-06 14:02:41 -07:00
2023-03-30 13:09:57 -07:00
:::warning
2023-06-02 14:13:02 -07:00
Certain Enterprise Browser Policies may impact Playwright's ability to launch and control Google Chrome and Microsoft Edge. Running in an environment with browser policies is outside of the Playwright project's scope.
2023-03-30 13:09:57 -07:00
:::
2023-02-28 18:09:44 +01:00
```js
import { defineConfig, devices } from '@playwright/test ';
export default defineConfig({
projects: [
/* Test against branded browsers. */
{
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' }, // or 'chrome-beta'
},
{
name: 'Microsoft Edge',
use: { ...devices['Desktop Edge'], channel: 'msedge' }, // or "msedge-beta" or 'msedge-dev'
},
],
});
2021-10-04 15:45:52 +02:00
```
2023-02-28 18:09:44 +01:00
```java
import com.microsoft.playwright.*;
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
public class Example {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
// Channel can be "chrome", "msedge", "chrome-beta", "msedge-beta" or "msedge-dev".
2023-03-07 17:53:12 +01:00
Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions().setChannel("msedge"));
2023-02-28 18:09:44 +01:00
Page page = browser.newPage();
// ...
}
}
}
2021-08-06 14:02:41 -07:00
```
2023-02-28 18:09:44 +01:00
```bash python
pytest test_login.py --browser-channel msedge
2021-10-04 15:45:52 +02:00
```
2023-02-28 18:09:44 +01:00
```xml csharp
<?xml version="1.0" encoding="utf-8"?>
< RunSettings >
< Playwright >
< BrowserName > chromium< / BrowserName >
< LaunchOptions >
< Channel > msedge< / Channel >
< / LaunchOptions >
< / Playwright >
< / RunSettings >
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2023-06-26 18:21:14 +02:00
```bash csharp
2023-02-28 18:09:44 +01:00
dotnet test -- Playwright.BrowserName=chromium Playwright.LaunchOptions.Channel=msedge
2021-08-06 14:02:41 -07:00
```
2023-02-28 18:09:44 +01:00
#### Installing Google Chrome & Microsoft Edge
If Google Chrome or Microsoft Edge is not available on your machine, you can install
them using the Playwright command line tool:
```bash lang=js
npx playwright install msedge
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
```bash lang=python
playwright install msedge
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
```bash lang=csharp
pwsh bin/Debug/netX/playwright.ps1 install msedge
2021-08-06 14:02:41 -07:00
```
2023-02-28 18:09:44 +01:00
```batch lang=java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install msedge"
```
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
:::warning
Google Chrome or Microsoft Edge installations will be installed at the
default global location of your operating system overriding your current browser installation.
2021-08-06 14:02:41 -07:00
:::
2023-02-28 18:09:44 +01:00
Run with the `--help` option to see a full a list of browsers that can be installed.
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
#### When to use Google Chrome & Microsoft Edge and when not to?
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
##### Defaults
2022-06-25 18:11:47 +02:00
2023-02-28 18:09:44 +01:00
Using the 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.
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
##### Regression testing
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
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"` .
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
##### 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 will also want to use the 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 part of the organization that uses such policies, it is 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.
### Firefox
Playwright's Firefox version matches the recent [Firefox Stable ](https://www.mozilla.org/en-US/firefox/new/ ) build. Playwright doesn't work with the branded version of Firefox since it relies on patches. Instead you can test against the recent Firefox Stable build.
### WebKit
2023-03-07 17:53:12 +01:00
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. Playwright doesn't work with the branded version of Safari since it relies on patches. Instead you can test against the recent WebKit build.
2022-12-28 15:13:45 -08:00
2021-08-06 14:02:41 -07:00
## Install behind a firewall or a proxy
2023-02-28 18:09:44 +01:00
By default, Playwright downloads browsers from Microsoft's CDN.
2021-08-06 14:02:41 -07:00
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.
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=js
2021-10-06 17:43:31 +02:00
# For Playwright Test
HTTPS_PROXY=https://192.0.2.1 npx playwright install
# For Playwright Library
HTTPS_PROXY=https://192.0.2.1 npm install playwright
```
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=js
2021-10-06 17:43:31 +02:00
# For Playwright Test
set HTTPS_PROXY=https://192.0.2.1
npx playwright install
# For Playwright Library
set HTTPS_PROXY=https://192.0.2.1
npm install playwright
```
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=js
2021-10-06 17:43:31 +02:00
# For Playwright Test
2023-03-07 17:53:12 +01:00
$Env:HTTPS_PROXY="https://192.0.2.1"
2021-10-06 17:43:31 +02:00
npx playwright install
# For Playwright Library
2023-03-07 17:53:12 +01:00
$Env:HTTPS_PROXY="https://192.0.2.1"
2021-10-06 17:43:31 +02:00
npm install playwright
```
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=python
2021-08-06 14:02:41 -07:00
pip install playwright
HTTPS_PROXY=https://192.0.2.1 playwright install
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=python
2021-08-06 14:02:41 -07:00
set HTTPS_PROXY=https://192.0.2.1
pip install playwright
playwright install
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=python
2023-03-07 17:53:12 +01:00
$Env:HTTPS_PROXY="https://192.0.2.1"
2021-08-06 14:02:41 -07:00
pip install playwright
playwright install
```
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=java
2023-01-05 19:55:07 +01:00
HTTPS_PROXY=https://192.0.2.1 mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=java
2021-08-06 14:02:41 -07:00
set HTTPS_PROXY=https://192.0.2.1
2023-01-05 19:55:07 +01:00
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=java
2023-03-07 17:53:12 +01:00
$Env:HTTPS_PROXY="https://192.0.2.1"
2023-01-05 19:55:07 +01:00
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
2021-08-06 14:02:41 -07:00
```
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=csharp
2022-08-14 20:01:00 +02:00
HTTPS_PROXY=https://192.0.2.1 pwsh bin/Debug/netX/playwright.ps1 install
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=csharp
2021-08-06 14:02:41 -07:00
set HTTPS_PROXY=https://192.0.2.1
2022-08-14 20:01:00 +02:00
pwsh bin/Debug/netX/playwright.ps1 install
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=csharp
2023-03-07 17:53:12 +01:00
$Env:HTTPS_PROXY="https://192.0.2.1"
2022-08-14 20:01:00 +02:00
pwsh bin/Debug/netX/playwright.ps1 install
2021-08-06 14:02:41 -07:00
```
2022-06-29 13:49:22 +02:00
If the requests of the proxy get intercepted with a custom untrusted certificate authority (CA) and it yields to `Error: self signed certificate in certificate chain` while downloading the browsers, you must set your custom root certificates via the [`NODE_EXTRA_CA_CERTS` ](https://nodejs.org/api/cli.html#node_extra_ca_certsfile ) environment variable before installing the browsers:
```bash tab=bash-bash
export NODE_EXTRA_CA_CERTS="/path/to/cert.pem"
```
```batch tab=bash-batch
set NODE_EXTRA_CA_CERTS="C:\certs\root.crt"
```
```powershell tab=bash-powershell
2023-03-07 17:53:12 +01:00
$Env:NODE_EXTRA_CA_CERTS="C:\certs\root.crt"
2022-06-29 13:49:22 +02:00
```
2022-10-19 13:06:35 -07:00
If your network is slow to connect to Playwright browser archive, you can increase the connection timeout in milliseconds with `PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT` environment variable:
```bash tab=bash-bash lang=js
PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000 npx playwright install
```
```batch tab=bash-batch lang=js
set PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000
npx playwright install
```
```powershell tab=bash-powershell lang=js
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT="120000"
2022-10-19 13:06:35 -07:00
npx playwright install
```
```bash tab=bash-bash lang=python
pip install playwright
PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000 playwright install
```
```batch tab=bash-batch lang=python
set PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000
pip install playwright
playwright install
```
```powershell tab=bash-powershell lang=python
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT="120000"
2022-10-19 13:06:35 -07:00
pip install playwright
playwright install
```
```bash tab=bash-bash lang=java
2023-01-05 19:55:07 +01:00
PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000 mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
2022-10-19 13:06:35 -07:00
```
```batch tab=bash-batch lang=java
set PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000
2023-01-05 19:55:07 +01:00
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
2022-10-19 13:06:35 -07:00
```
```powershell tab=bash-powershell lang=java
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT="120000"
2023-01-05 19:55:07 +01:00
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
2022-10-19 13:06:35 -07:00
```
```bash tab=bash-bash lang=csharp
PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000 pwsh bin/Debug/netX/playwright.ps1 install
```
```batch tab=bash-batch lang=csharp
set PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000
pwsh bin/Debug/netX/playwright.ps1 install
```
```powershell tab=bash-powershell lang=csharp
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT="120000"
2022-10-19 13:06:35 -07:00
pwsh bin/Debug/netX/playwright.ps1 install
```
2021-08-06 14:02:41 -07:00
## Download from artifact repository
2023-02-28 18:09:44 +01:00
By default, Playwright downloads browsers from Microsoft's CDN.
2021-08-06 14:02:41 -07:00
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.
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=js
2021-10-06 17:43:31 +02:00
# For Playwright Test
PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npx playwright install
# For Playwright Library
PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npm install playwright
```
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=js
2021-10-06 17:43:31 +02:00
# For Playwright Test
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
npx playwright install
# For Playwright Library
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
npm install playwright
```
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=js
2021-10-06 17:43:31 +02:00
# For Playwright Test
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
2021-10-06 17:43:31 +02:00
npx playwright install
# For Playwright Library
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
2021-10-06 17:43:31 +02:00
npm install playwright
```
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=python
2021-08-06 14:02:41 -07:00
pip install playwright
PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 playwright install
2021-10-04 15:45:52 +02:00
```
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=python
2021-08-06 14:02:41 -07:00
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
pip install playwright
playwright install
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=python
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
2021-08-06 14:02:41 -07:00
pip install playwright
playwright install
```
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=java
2023-01-05 19:55:07 +01:00
PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=java
2021-08-06 14:02:41 -07:00
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
2023-01-05 19:55:07 +01:00
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=java
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
2023-01-05 19:55:07 +01:00
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
2021-08-06 14:02:41 -07:00
```
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=csharp
2022-08-14 20:01:00 +02:00
PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 pwsh bin/Debug/netX/playwright.ps1 install
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=csharp
2021-08-06 14:02:41 -07:00
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
2022-08-14 20:01:00 +02:00
pwsh bin/Debug/netX/playwright.ps1 install
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=csharp
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
2022-08-14 20:01:00 +02:00
pwsh bin/Debug/netX/playwright.ps1 install
2021-08-06 14:02:41 -07:00
```
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` .
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=js
2021-10-06 17:43:31 +02:00
# For Playwright Test
PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npx playwright install
# For Playwright Library
PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npm install playwright
```
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=js
2021-10-06 17:43:31 +02:00
# For Playwright Test
set PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
npx playwright install
# For Playwright Library
set PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
npm install playwright
```
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=js
2021-10-06 17:43:31 +02:00
# For Playwright Test
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"
$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
2021-10-06 17:43:31 +02:00
npx playwright install
# For Playwright Library
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"
$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
2021-10-06 17:43:31 +02:00
npm install playwright
```
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=python
2021-08-06 14:02:41 -07:00
pip install playwright
2021-10-06 17:43:31 +02:00
PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 playwright install
2021-08-06 14:02:41 -07:00
```
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=python
2021-10-06 17:43:31 +02:00
set PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
pip install playwright
playwright install
```
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=python
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"
$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
2021-10-06 17:43:31 +02:00
pip install playwright
playwright install
```
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=java
2023-01-05 19:55:07 +01:00
PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
2021-08-06 14:02:41 -07:00
```
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=java
2021-10-06 17:43:31 +02:00
set PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
2023-01-05 19:55:07 +01:00
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
2021-10-06 17:43:31 +02:00
```
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=java
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"
$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
2023-01-05 19:55:07 +01:00
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
2021-10-06 17:43:31 +02:00
```
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=csharp
2022-08-14 20:01:00 +02:00
PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 pwsh bin/Debug/netX/playwright.ps1 install
2021-08-06 14:02:41 -07:00
```
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=csharp
2021-10-06 17:43:31 +02:00
set PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
2022-08-14 20:01:00 +02:00
pwsh bin/Debug/netX/playwright.ps1 install
2021-10-06 17:43:31 +02:00
```
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=csharp
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
$Env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"
2022-08-14 20:01:00 +02:00
pwsh bin/Debug/netX/playwright.ps1 install
2021-10-06 17:43:31 +02:00
```
2023-02-28 18:09:44 +01:00
## 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:
```bash
du -hs ~/Library/Caches/ms-playwright/*
281M chromium-XXXXXX
187M firefox-XXXX
180M webkit-XXXX
```
You can override default behavior using environment variables. When installing Playwright, ask it to download browsers into a specific location:
```bash tab=bash-bash lang=js
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install
```
```batch tab=bash-batch lang=js
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
npx playwright install
```
```powershell tab=bash-powershell lang=js
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_BROWSERS_PATH="$Env:USERPROFILE\pw-browsers"
2023-02-28 18:09:44 +01:00
npx playwright install
```
```bash tab=bash-bash lang=python
pip install playwright
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python -m playwright install
```
```batch tab=bash-batch lang=python
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
pip install playwright
playwright install
```
```powershell tab=bash-powershell lang=python
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_BROWSERS_PATH="$Env:USERPROFILE\pw-browsers"
2023-02-28 18:09:44 +01:00
pip install playwright
playwright install
```
```bash tab=bash-bash lang=java
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
```
```batch tab=bash-batch lang=java
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
```
```powershell tab=bash-powershell lang=java
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_BROWSERS_PATH="$Env:USERPROFILE\pw-browsers"
2023-02-28 18:09:44 +01:00
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
```
```bash tab=bash-bash lang=csharp
2023-03-07 17:53:12 +01:00
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers pwsh bin/Debug/netX/playwright.ps1 install
2023-02-28 18:09:44 +01:00
```
```batch tab=bash-batch lang=csharp
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
pwsh bin/Debug/netX/playwright.ps1 install
```
```powershell tab=bash-powershell lang=csharp
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_BROWSERS_PATH="$Env:USERPROFILE\pw-browsers"
2023-02-28 18:09:44 +01:00
pwsh bin/Debug/netX/playwright.ps1 install
```
When running Playwright scripts, ask it to search for browsers in a shared location.
```bash tab=bash-bash lang=js
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright test
```
```batch tab=bash-batch lang=js
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
npx playwright test
```
```powershell tab=bash-powershell lang=js
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_BROWSERS_PATH="$Env:USERPROFILE\pw-browsers"
2023-02-28 18:09:44 +01:00
npx playwright test
```
```bash tab=bash-bash lang=python
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python playwright_script.py
```
```batch tab=bash-batch lang=python
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
python playwright_script.py
```
```powershell tab=bash-powershell lang=python
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_BROWSERS_PATH="$Env:USERPROFILE\pw-browsers"
2023-02-28 18:09:44 +01:00
python playwright_script.py
```
2021-10-06 17:43:31 +02:00
2023-02-28 18:09:44 +01:00
```bash tab=bash-bash lang=java
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers mvn test
```
```batch tab=bash-batch lang=java
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
mvn test
```
```powershell tab=bash-powershell lang=java
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_BROWSERS_PATH="$Env:USERPROFILE\pw-browsers"
2023-02-28 18:09:44 +01:00
mvn test
```
```bash tab=bash-bash lang=csharp
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers dotnet test
```
```batch tab=bash-batch lang=csharp
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
dotnet test
```
```powershell tab=bash-powershell lang=csharp
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_BROWSERS_PATH="$Env:USERPROFILE\pw-browsers"
2023-02-28 18:09:44 +01:00
dotnet 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` .
:::
### Hermetic install
* langs: js
You can opt into the hermetic install and place binaries in the local folder:
```bash tab=bash-bash
# Places binaries to node_modules/playwright-core/.local-browsers
PLAYWRIGHT_BROWSERS_PATH=0 npx playwright install
```
```batch tab=bash-batch
# Places binaries to node_modules\playwright-core\.local-browsers
set PLAYWRIGHT_BROWSERS_PATH=0
npx playwright install
```
```powershell tab=bash-powershell
# Places binaries to node_modules\playwright-core\.local-browsers
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_BROWSERS_PATH=0
2023-02-28 18:09:44 +01:00
npx playwright install
```
:::note
`PLAYWRIGHT_BROWSERS_PATH` does not change installation path for Google Chrome and Microsoft Edge.
:::
### Skip browser downloads
2023-08-22 13:22:38 -07:00
* langs: java
2021-08-06 14:02:41 -07:00
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.
2022-06-10 16:34:31 -08:00
```bash tab=bash-bash lang=java
2021-08-06 14:02:41 -07:00
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 mvn test
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```batch tab=bash-batch lang=java
2021-08-06 14:02:41 -07:00
set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
mvn test
2021-10-04 15:45:52 +02:00
```
2021-08-06 14:02:41 -07:00
2022-06-10 16:34:31 -08:00
```powershell tab=bash-powershell lang=java
2023-03-07 17:53:12 +01:00
$Env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
2021-08-06 14:02:41 -07:00
mvn test
```
2023-02-28 18:09:44 +01:00
### Stale browser removal
2021-08-06 14:02:41 -07:00
2023-02-28 18:09:44 +01:00
Playwright keeps track of the clients that use its browsers. When there are no more clients that require a 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.
2021-08-06 14:02:41 -07:00
To opt-out from the unused browser removal, you can set the `PLAYWRIGHT_SKIP_BROWSER_GC=1` environment variable.
2023-06-05 18:50:21 +02:00
2023-06-06 22:09:15 +02:00
### Uninstall browsers
2023-06-05 18:50:21 +02:00
This will remove the browsers (chromium, firefox, webkit) of the current Playwright installation:
```bash js
npx playwright uninstall
```
```bash java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="uninstall"
```
```bash python
playwright uninstall
```
```bash csharp
pwsh bin/Debug/netX/playwright.ps1 uninstall
```
To remove browsers of other Playwright installations as well, pass `--all` flag:
```bash js
npx playwright uninstall --all
```
```bash java
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="uninstall --all"
```
```bash python
playwright uninstall --all
```
```bash csharp
pwsh bin/Debug/netX/playwright.ps1 uninstall --all
```