docs(browsers): fix missing JS snippets (#9339)

This commit is contained in:
Max Schmitt 2021-10-06 17:43:31 +02:00 committed by GitHub
parent e8fdbbfa03
commit 480e5a69e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -146,21 +146,6 @@ dotnet tool install -g Microsoft.Playwright.CLI
Playwright can install supported browsers by means of the CLI tool. Playwright can install supported browsers by means of the CLI tool.
```bash js
# Running without arguments will install all browsers
npx playwright install
```
```bash java
# Running without arguments will install all browsers
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
```
```bash python
# Running without arguments will install all browsers
playwright install
```
```bash csharp ```bash csharp
# Running without arguments will install all browsers # Running without arguments will install all browsers
playwright install playwright install
@ -168,21 +153,6 @@ playwright install
You can also install specific browsers by providing an argument: You can also install specific browsers by providing an argument:
```bash js
# Install WebKit
npx playwright install webkit
```
```bash java
# Install WebKit
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install webkit"
```
```bash python
# Install WebKit
playwright install webkit
```
```bash csharp ```bash csharp
# Install WebKit # Install WebKit
playwright install webkit playwright install webkit
@ -190,18 +160,6 @@ playwright install webkit
See all supported browsers: See all supported browsers:
```bash js
npx playwright install --help
```
```bash java
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install --help"
```
```bash python
playwright install --help
```
```bash csharp ```bash csharp
playwright install --help playwright install --help
``` ```
@ -380,6 +338,34 @@ By default, Playwright downloads browsers from Microsoft CDN.
Sometimes companies maintain an internal proxy that blocks direct access to the public 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. resources. In this case, Playwright can be configured to download browsers via a proxy server.
```bash bash-flavor=bash lang=js
# 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
```
```bash bash-flavor=batch lang=js
# 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
```
```bash bash-flavor=powershell lang=js
# For Playwright Test
$env:HTTPS_PROXY="https://192.0.2.1"
npx playwright install
# For Playwright Library
$env:HTTPS_PROXY="https://192.0.2.1"
npm install playwright
```
```bash bash-flavor=bash lang=python ```bash bash-flavor=bash lang=python
pip install playwright pip install playwright
HTTPS_PROXY=https://192.0.2.1 playwright install HTTPS_PROXY=https://192.0.2.1 playwright install
@ -433,10 +419,37 @@ Sometimes companies maintain an internal artifact repository to host browser
binaries. In this case, Playwright can be configured to download from a custom binaries. In this case, Playwright can be configured to download from a custom
location using the `PLAYWRIGHT_DOWNLOAD_HOST` env variable. location using the `PLAYWRIGHT_DOWNLOAD_HOST` env variable.
```bash bash-flavor=bash lang=js
# 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
```
```bash bash-flavor=batch lang=js
# 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
```
```bash bash-flavor=powershell lang=js
# For Playwright Test
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
npx playwright install
# For Playwright Library
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
npm install playwright
```
```bash bash-flavor=bash lang=python ```bash bash-flavor=bash lang=python
pip install playwright pip install playwright
PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 playwright install PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 playwright install
``` ```
```bash bash-flavor=batch lang=python ```bash bash-flavor=batch lang=python
@ -482,22 +495,89 @@ playwright install
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
take precedence over `PLAYWRIGHT_DOWNLOAD_HOST`. take precedence over `PLAYWRIGHT_DOWNLOAD_HOST`.
```bash python ```bash bash-flavor=bash lang=js
# Linux/macOS # For Playwright Test
pip install playwright PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npx playwright install
PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 python -m playwright install
# For Playwright Library
PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npm install playwright
``` ```
```bash java ```bash bash-flavor=batch lang=js
# Linux/macOS # 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
```
```bash bash-flavor=powershell lang=js
# For Playwright Test
$env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
npx playwright install
# For Playwright Library
$env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
npm install playwright
```
```bash bash-flavor=bash lang=python
pip install playwright
PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 playwright install
```
```bash bash-flavor=batch lang=python
set PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
pip install playwright
playwright install
```
```bash bash-flavor=powershell lang=python
$env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
pip install playwright
playwright install
```
```bash bash-flavor=bash lang=java
PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 mvn test PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 mvn test
``` ```
```bash csharp ```bash bash-flavor=batch lang=java
# Linux/macOS set PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
mvn test
```
```bash bash-flavor=powershell lang=java
$env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
mvn test
```
```bash bash-flavor=bash lang=csharp
PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 playwright install PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 playwright install
``` ```
```bash bash-flavor=batch lang=csharp
set PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
playwright install
```
```bash bash-flavor=powershell lang=csharp
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
$env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"
playwright install
```
## Skip browser downloads ## Skip browser downloads
In certain cases, it is desired to avoid browser downloads altogether because In certain cases, it is desired to avoid browser downloads altogether because