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
PWDEBUG=console npm run test
# Windows
# Windows with cmd.exe
set PWDEBUG=console
npm run test
# Windows with PowerShell
$env:PWDEBUG="console"
npm run test
```
```sh java
# Linux/macOS
PWDEBUG=console mvn test
# Windows
# Windows with cmd.exe
set PWDEBUG=console
mvn test
# Windows with PowerShell
$env:PWDEBUG="console"
mvn test
```
```sh python
# Linux/macOS
PWDEBUG=console pytest -s
# Windows
# Windows with cmd.exe
set PWDEBUG=console
pytest -s
# Windows with PowerShell
$env:PWDEBUG="console"
pytest -s
```
## Selectors in Developer Tools Console
@ -176,31 +188,50 @@ Playwright supports verbose logging with the `DEBUG` environment variable.
# Linux/macOS
DEBUG=pw:api npm run test
# Windows
# Windows with cmd.exe
set DEBUG=pw:api
npm run test
# Windows with PowerShell
$env:DEBUG="pw:api"
npm run test
```
```sh java
# Linux/macOS
DEBUG=pw:api mvn test
# Windows
# Windows with cmd.exe
set DEBUG=pw:api
mvn test
# Windows with PowerShell
$env:DEBUG="pw:api"
mvn test
```
```sh python
# Linux/macOS
DEBUG=pw:api pytest -s
# Windows
# Windows with cmd.exe
set DEBUG=pw:api
pytest -s
# Windows with PowerShell
$env:DEBUG="pw:api"
pytest -s
```
```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"
dotnet run
```

View file

@ -19,28 +19,41 @@ configures Playwright for debugging and opens the inspector.
# Linux/macOS
PWDEBUG=1 npm run test
# Windows
# Windows with cmd.exe
set PWDEBUG=1
npm run test
# Windows with PowerShell
$env:PWDEBUG=1
npm run test
```
```sh java
# Linux/macOS
PWDEBUG=1 PLAYWRIGHT_JAVA_SRC=<java src root> mvn test
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_JAVA_SRC=<java src root>
set PWDEBUG=1
mvn test
# Windows with PowerShell
$env:PLAYWRIGHT_JAVA_SRC="<java src root>"
$env:PWDEBUG=1
mvn test
```
```sh python
# Linux/macOS
PWDEBUG=1 pytest -s
# Windows
# Windows with cmd.exe
set PWDEBUG=1
pytest -s
# Windows with PowerShell
$env:PWDEBUG=1
pytest -s
```
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
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npm i -D playwright
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
npm i -D playwright
# Windows with PowerShell
$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"
npm i -D playwright
```
```sh python
@ -47,10 +51,15 @@ npm i -D playwright
pip install playwright
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python -m playwright install
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
pip install playwright
playwright install
# Windows with PowerShell
$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"
pip install playwright
playwright install
```
```sh java
@ -64,24 +73,36 @@ When running Playwright scripts, ask it to search for browsers in a shared locat
# Linux/macOS
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers node playwright-script.js
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
node playwright-script.js
# Windows with PowerShell
$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"
node playwright-script.js
```
```sh python
# Linux/macOS
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python playwright_script.js
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
python playwright_script.py
# Windows with PowerShell
$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"
python playwright_script.py
```
```sh java
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
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:
@ -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
PLAYWRIGHT_BROWSERS_PATH=0 npm i -D playwright
# Windows
# Windows with cmd.exe
# Places binaries to node_modules\playwright
set PLAYWRIGHT_BROWSERS_PATH=0
npm i -D playwright
# Windows with PowerShell
# Places binaries to node_modules\playwright
$env:PLAYWRIGHT_BROWSERS_PATH=0
npm i -D playwright
```
```sh python
@ -102,10 +128,15 @@ npm i -D playwright
pip install playwright
PLAYWRIGHT_BROWSERS_PATH=0 playwright install
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_BROWSERS_PATH=0
pip install playwright
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.
@ -125,9 +156,13 @@ resources. In this case, Playwright can be configured to download browsers via a
# Linux/macOS
HTTPS_PROXY=https://192.168.1.78 npm i -D playwright
# Windows
# Windows with cmd.exe
set HTTPS_PROXY=https://192.168.1.78
npm i -D playwright
# Windows with PowerShell
$env:HTTPS_PROXY="https://192.168.1.78"
npm i -D playwright
```
```sh python
@ -135,19 +170,28 @@ npm i -D playwright
pip install playwright
HTTPS_PROXY=https://192.168.1.78 playwright install
# Windows
# Windows with cmd.exe
set HTTPS_PROXY=https://192.168.1.78
pip install playwright
playwright install
# Windows with PowerShell
$env:HTTPS_PROXY="https://192.168.1.78"
pip install playwright
playwright install
```
```sh java
# Linux/macOS
HTTPS_PROXY=https://192.168.1.78 mvn test
# Windows
# Windows with cmd.exe
set HTTPS_PROXY=https://192.168.1.78
mvn test
# Windows with PowerShell
$env:HTTPS_PROXY="https://192.168.1.78"
mvn test
```
## Download from artifact repository
@ -162,9 +206,13 @@ location using the `PLAYWRIGHT_DOWNLOAD_HOST` env variable.
# Linux/macOS
PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 npm i -D playwright
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78
npm i -D playwright
# Windows with PowerShell
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.168.1.78"
npm i -D playwright
```
```sh python
@ -172,19 +220,28 @@ npm i -D playwright
pip install playwright
PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 playwright install
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78
pip install playwright
playwright install
# Windows with PowerShell
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.168.1.78"
pip install playwright
playwright install
```
```sh java
# Linux/macOS
PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 mvn test
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78
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
@ -219,9 +276,13 @@ This can be done by setting `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` variable before i
# Linux/macOS
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
npm i -D playwright
# Windows with PowerShell
$env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
npm i -D playwright
```
```sh python
@ -229,19 +290,28 @@ npm i -D playwright
pip install playwright
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 python -m playwright install
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
pip install playwright
playwright install
# Windows with PowerShell
$env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
pip install playwright
playwright install
```
```sh java
# Linux/macOS
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 mvn test
# Windows
# Windows with cmd.exe
set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
mvn test
# Windows with PowerShell
$env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
mvn test
```
## Download single browser binary