docs: provide examples for PowerShell when settings env vars (#6718)

This commit is contained in:
Max Schmitt 2021-05-25 07:10:22 +02:00 committed by GitHub
parent 30e5681b82
commit f629cbe053
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 140 additions and 26 deletions

View file

@ -109,27 +109,39 @@ composite selectors.
# Linux/macOS # Linux/macOS
PWDEBUG=console npm run test PWDEBUG=console npm run test
# Windows # Windows with cmd.exe
set PWDEBUG=console set PWDEBUG=console
npm run test npm run test
# Windows with PowerShell
$env:PWDEBUG="console"
npm run test
``` ```
```sh java ```sh java
# Linux/macOS # Linux/macOS
PWDEBUG=console mvn test PWDEBUG=console mvn test
# Windows # Windows with cmd.exe
set PWDEBUG=console set PWDEBUG=console
mvn test mvn test
# Windows with PowerShell
$env:PWDEBUG="console"
mvn test
``` ```
```sh python ```sh python
# Linux/macOS # Linux/macOS
PWDEBUG=console pytest -s PWDEBUG=console pytest -s
# Windows # Windows with cmd.exe
set PWDEBUG=console set PWDEBUG=console
pytest -s pytest -s
# Windows with PowerShell
$env:PWDEBUG="console"
pytest -s
``` ```
## Selectors in Developer Tools Console ## Selectors in Developer Tools Console
@ -176,31 +188,50 @@ Playwright supports verbose logging with the `DEBUG` environment variable.
# Linux/macOS # Linux/macOS
DEBUG=pw:api npm run test DEBUG=pw:api npm run test
# Windows # Windows with cmd.exe
set DEBUG=pw:api set DEBUG=pw:api
npm run test npm run test
# Windows with PowerShell
$env:DEBUG="pw:api"
npm run test
``` ```
```sh java ```sh java
# Linux/macOS # Linux/macOS
DEBUG=pw:api mvn test DEBUG=pw:api mvn test
# Windows # Windows with cmd.exe
set DEBUG=pw:api set DEBUG=pw:api
mvn test mvn test
# Windows with PowerShell
$env:DEBUG="pw:api"
mvn test
``` ```
```sh python ```sh python
# Linux/macOS # Linux/macOS
DEBUG=pw:api pytest -s DEBUG=pw:api pytest -s
# Windows # Windows with cmd.exe
set DEBUG=pw:api set DEBUG=pw:api
pytest -s pytest -s
# Windows with PowerShell
$env:DEBUG="pw:api"
pytest -s
``` ```
```sh csharp ```sh csharp
# Powershell (Win/macOS) # Linux/macOS
DEBUG=pw:api dotnet run
# Windows with cmd.exe
set DEBUG=pw:api
dotnet run
# Windows with PowerShell
$env:DEBUG="pw:api" $env:DEBUG="pw:api"
dotnet run dotnet run
``` ```

View file

@ -19,28 +19,41 @@ configures Playwright for debugging and opens the inspector.
# Linux/macOS # Linux/macOS
PWDEBUG=1 npm run test PWDEBUG=1 npm run test
# Windows # Windows with cmd.exe
set PWDEBUG=1 set PWDEBUG=1
npm run test npm run test
# Windows with PowerShell
$env:PWDEBUG=1
npm run test
``` ```
```sh java ```sh java
# Linux/macOS # Linux/macOS
PWDEBUG=1 PLAYWRIGHT_JAVA_SRC=<java src root> mvn test PWDEBUG=1 PLAYWRIGHT_JAVA_SRC=<java src root> mvn test
# Windows # Windows with cmd.exe
set PLAYWRIGHT_JAVA_SRC=<java src root> set PLAYWRIGHT_JAVA_SRC=<java src root>
set PWDEBUG=1 set PWDEBUG=1
mvn test mvn test
# Windows with PowerShell
$env:PLAYWRIGHT_JAVA_SRC="<java src root>"
$env:PWDEBUG=1
mvn test
``` ```
```sh python ```sh python
# Linux/macOS # Linux/macOS
PWDEBUG=1 pytest -s PWDEBUG=1 pytest -s
# Windows # Windows with cmd.exe
set PWDEBUG=1 set PWDEBUG=1
pytest -s pytest -s
# Windows with PowerShell
$env:PWDEBUG=1
pytest -s
``` ```
Additional useful defaults are configured when `PWDEBUG=1` is set: Additional useful defaults are configured when `PWDEBUG=1` is set:

View file

@ -37,9 +37,13 @@ You can override default behavior using environment variables. When installing P
# Linux/macOS # Linux/macOS
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npm i -D playwright PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npm i -D playwright
# Windows # Windows with cmd.exe
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
npm i -D playwright npm i -D playwright
# Windows with PowerShell
$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"
npm i -D playwright
``` ```
```sh python ```sh python
@ -47,10 +51,15 @@ npm i -D playwright
pip install playwright pip install playwright
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python -m playwright install PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python -m playwright install
# Windows # Windows with cmd.exe
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
pip install playwright pip install playwright
playwright install playwright install
# Windows with PowerShell
$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"
pip install playwright
playwright install
``` ```
```sh java ```sh java
@ -64,24 +73,36 @@ When running Playwright scripts, ask it to search for browsers in a shared locat
# Linux/macOS # Linux/macOS
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers node playwright-script.js PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers node playwright-script.js
# Windows # Windows with cmd.exe
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
node playwright-script.js node playwright-script.js
# Windows with PowerShell
$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"
node playwright-script.js
``` ```
```sh python ```sh python
# Linux/macOS # Linux/macOS
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python playwright_script.js PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python playwright_script.js
# Windows # Windows with cmd.exe
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
python playwright_script.py python playwright_script.py
# Windows with PowerShell
$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"
python playwright_script.py
``` ```
```sh java ```sh java
# Windows # Windows with cmd.exe
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
mvn test mvn test
# Windows with PowerShell
$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"
mvn test
``` ```
Or you can opt into the hermetic install and place binaries in the local folder: Or you can opt into the hermetic install and place binaries in the local folder:
@ -91,10 +112,15 @@ Or you can opt into the hermetic install and place binaries in the local folder:
# Places binaries to node_modules/playwright # Places binaries to node_modules/playwright
PLAYWRIGHT_BROWSERS_PATH=0 npm i -D playwright PLAYWRIGHT_BROWSERS_PATH=0 npm i -D playwright
# Windows # Windows with cmd.exe
# Places binaries to node_modules\playwright # Places binaries to node_modules\playwright
set PLAYWRIGHT_BROWSERS_PATH=0 set PLAYWRIGHT_BROWSERS_PATH=0
npm i -D playwright npm i -D playwright
# Windows with PowerShell
# Places binaries to node_modules\playwright
$env:PLAYWRIGHT_BROWSERS_PATH=0
npm i -D playwright
``` ```
```sh python ```sh python
@ -102,10 +128,15 @@ npm i -D playwright
pip install playwright pip install playwright
PLAYWRIGHT_BROWSERS_PATH=0 playwright install PLAYWRIGHT_BROWSERS_PATH=0 playwright install
# Windows # Windows with cmd.exe
set PLAYWRIGHT_BROWSERS_PATH=0 set PLAYWRIGHT_BROWSERS_PATH=0
pip install playwright pip install playwright
playwright install playwright install
# Windows with PowerShell
$env:PLAYWRIGHT_BROWSERS_PATH=0
pip install playwright
playwright install
``` ```
Playwright keeps track of packages that need those browsers and will garbage collect them as you update Playwright to the newer versions. Playwright keeps track of packages that need those browsers and will garbage collect them as you update Playwright to the newer versions.
@ -125,9 +156,13 @@ resources. In this case, Playwright can be configured to download browsers via a
# Linux/macOS # Linux/macOS
HTTPS_PROXY=https://192.168.1.78 npm i -D playwright HTTPS_PROXY=https://192.168.1.78 npm i -D playwright
# Windows # Windows with cmd.exe
set HTTPS_PROXY=https://192.168.1.78 set HTTPS_PROXY=https://192.168.1.78
npm i -D playwright npm i -D playwright
# Windows with PowerShell
$env:HTTPS_PROXY="https://192.168.1.78"
npm i -D playwright
``` ```
```sh python ```sh python
@ -135,19 +170,28 @@ npm i -D playwright
pip install playwright pip install playwright
HTTPS_PROXY=https://192.168.1.78 playwright install HTTPS_PROXY=https://192.168.1.78 playwright install
# Windows # Windows with cmd.exe
set HTTPS_PROXY=https://192.168.1.78 set HTTPS_PROXY=https://192.168.1.78
pip install playwright pip install playwright
playwright install playwright install
# Windows with PowerShell
$env:HTTPS_PROXY="https://192.168.1.78"
pip install playwright
playwright install
``` ```
```sh java ```sh java
# Linux/macOS # Linux/macOS
HTTPS_PROXY=https://192.168.1.78 mvn test HTTPS_PROXY=https://192.168.1.78 mvn test
# Windows # Windows with cmd.exe
set HTTPS_PROXY=https://192.168.1.78 set HTTPS_PROXY=https://192.168.1.78
mvn test mvn test
# Windows with PowerShell
$env:HTTPS_PROXY="https://192.168.1.78"
mvn test
``` ```
## Download from artifact repository ## Download from artifact repository
@ -162,9 +206,13 @@ location using the `PLAYWRIGHT_DOWNLOAD_HOST` env variable.
# Linux/macOS # Linux/macOS
PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 npm i -D playwright PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 npm i -D playwright
# Windows # Windows with cmd.exe
set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78
npm i -D playwright npm i -D playwright
# Windows with PowerShell
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.168.1.78"
npm i -D playwright
``` ```
```sh python ```sh python
@ -172,19 +220,28 @@ npm i -D playwright
pip install playwright pip install playwright
PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 playwright install PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 playwright install
# Windows # Windows with cmd.exe
set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78
pip install playwright pip install playwright
playwright install playwright install
# Windows with PowerShell
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.168.1.78"
pip install playwright
playwright install
``` ```
```sh java ```sh java
# Linux/macOS # Linux/macOS
PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 mvn test PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 mvn test
# Windows # Windows with cmd.exe
set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78
mvn test mvn test
# Windows with PowerShell
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.168.1.78"
mvn test
``` ```
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 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
@ -219,9 +276,13 @@ This can be done by setting `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` variable before i
# Linux/macOS # Linux/macOS
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright
# Windows # Windows with cmd.exe
set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
npm i -D playwright npm i -D playwright
# Windows with PowerShell
$env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
npm i -D playwright
``` ```
```sh python ```sh python
@ -229,19 +290,28 @@ npm i -D playwright
pip install playwright pip install playwright
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 python -m playwright install PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 python -m playwright install
# Windows # Windows with cmd.exe
set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
pip install playwright pip install playwright
playwright install playwright install
# Windows with PowerShell
$env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
pip install playwright
playwright install
``` ```
```sh java ```sh java
# Linux/macOS # Linux/macOS
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 mvn test PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 mvn test
# Windows # Windows with cmd.exe
set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
mvn test mvn test
# Windows with PowerShell
$env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
mvn test
``` ```
## Download single browser binary ## Download single browser binary