Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs: make environment vars snippets cross-platform (#2564)
Arjun Attam2659910be872
diff --git a/docs/api.md b/docs/api.mdindex 2bc64ca19f..2f69fcf64c 100644--- a/docs/api.md+++ b/docs/api.md@@ -4420,10 +4420,19 @@ If Playwright doesn't find them in the environment, a lowercased variant of thes- `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` - set to non-empty value to skip browser downloads altogether.```sh+# Linux/macOS# Install browsers to the shared location.$ PLAYWRIGHT_BROWSERS_PATH=$HOME/playwright-browsers npm install --save-dev playwright# Use shared location to find browsers.$ PLAYWRIGHT_BROWSERS_PATH=$HOME/playwright-browsers node playwright-script.js++# Windows+# Install browsers to the shared location.+$ set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\playwright-browsers+$ npm install --save-dev playwright+# Use shared location to find browsers.+$ set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\playwright-browsers+$ node playwright-script.js```diff --git a/docs/installation.md b/docs/installation.mdindex 2863427469..e37a0ea383 100644--- a/docs/installation.md+++ b/docs/installation.md@@ -33,19 +33,34 @@ du -hs ./Library/Caches/ms-playwright/*You can override default behavior using environment variables. When installing Playwright, ask it to download browsers into a specific location:```sh+# Linux/macOS$ PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npm i -D playwright++# Windows+$ set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers+$ npm i -D playwright```When running Playwright scripts, ask it to search for browsers in a shared location:```sh+# Linux/macOS$ PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers node playwright-script.js++# Windows+$ set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers+$ node playwright-script.js```Or you can opt into the hermetic install and place binaries under the `node_modules/` folder:```sh-$ PLAYWRIGHT_BROWSERS_PATH=0 node playwright-script.js+# Linux/macOS+$ PLAYWRIGHT_BROWSERS_PATH=0 npm i -D playwright++# Windows+$ set PLAYWRIGHT_BROWSERS_PATH=0+$ npm i -D playwright```Playwright keeps track of packages that need those browsers and will garbage collect them as you update Playwright to the newer versions.@@ -65,7 +80,12 @@ binaries. In this case, Playwright can be configured to download from a customlocation using the `PLAYWRIGHT_DOWNLOAD_HOST` env variable.```sh+# Linux/macOS$ PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 npm i -D playwright++# Windows+$ set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78+$ npm i -D playwright```<br>@@ -78,7 +98,12 @@ browser binaries are managed separately.This can be done by setting `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` variable before installation.```sh+# Linux/macOS$ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright++# Windows+$ set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1+$ npm i -D playwright```<br>@@ -108,6 +133,6 @@ const { webkit } = require('playwright-webkit');(async () => {const browser = await webkit.launch();- // ....+ // ...})();```