mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: fix Java CLI invocation on Windows (#19895)
For reference: https://stackoverflow.com/a/64300409
This commit is contained in:
parent
3883799d68
commit
ddccb59093
@ -126,11 +126,11 @@ pwsh bin/Debug/netX/playwright.ps1 install msedge
|
|||||||
```
|
```
|
||||||
|
|
||||||
```batch lang=java
|
```batch lang=java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install msedge"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install msedge"
|
||||||
```
|
```
|
||||||
|
|
||||||
```powershell lang=java
|
```powershell lang=java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install msedge"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install msedge"
|
||||||
```
|
```
|
||||||
|
|
||||||
Run with `--help` option to see full list of the browsers that can be installed this way.
|
Run with `--help` option to see full list of the browsers that can be installed this way.
|
||||||
@ -262,17 +262,17 @@ playwright install
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash tab=bash-bash lang=java
|
```bash tab=bash-bash lang=java
|
||||||
PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
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
|
```batch tab=bash-batch lang=java
|
||||||
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
|
set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```powershell tab=bash-powershell lang=java
|
```powershell tab=bash-powershell lang=java
|
||||||
$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"
|
$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash tab=bash-bash lang=csharp
|
```bash tab=bash-bash lang=csharp
|
||||||
@ -436,17 +436,17 @@ playwright install
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash tab=bash-bash lang=java
|
```bash tab=bash-bash lang=java
|
||||||
HTTPS_PROXY=https://192.0.2.1 mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
HTTPS_PROXY=https://192.0.2.1 mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```batch tab=bash-batch lang=java
|
```batch tab=bash-batch lang=java
|
||||||
set HTTPS_PROXY=https://192.0.2.1
|
set HTTPS_PROXY=https://192.0.2.1
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```powershell tab=bash-powershell lang=java
|
```powershell tab=bash-powershell lang=java
|
||||||
$env:HTTPS_PROXY="https://192.0.2.1"
|
$env:HTTPS_PROXY="https://192.0.2.1"
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash tab=bash-bash lang=csharp
|
```bash tab=bash-bash lang=csharp
|
||||||
@ -511,17 +511,17 @@ playwright install
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash tab=bash-bash lang=java
|
```bash tab=bash-bash lang=java
|
||||||
PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000 mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000 mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```batch tab=bash-batch lang=java
|
```batch tab=bash-batch lang=java
|
||||||
set PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000
|
set PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT=120000
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```powershell tab=bash-powershell lang=java
|
```powershell tab=bash-powershell lang=java
|
||||||
$env:PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT="120000"
|
$env:PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT="120000"
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash tab=bash-bash lang=csharp
|
```bash tab=bash-bash lang=csharp
|
||||||
@ -592,17 +592,17 @@ playwright install
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash tab=bash-bash lang=java
|
```bash tab=bash-bash lang=java
|
||||||
PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```batch tab=bash-batch lang=java
|
```batch tab=bash-batch lang=java
|
||||||
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
|
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```powershell tab=bash-powershell lang=java
|
```powershell tab=bash-powershell lang=java
|
||||||
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
|
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash tab=bash-bash lang=csharp
|
```bash tab=bash-bash lang=csharp
|
||||||
@ -674,19 +674,19 @@ playwright install
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash tab=bash-bash lang=java
|
```bash tab=bash-bash lang=java
|
||||||
PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
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"
|
||||||
```
|
```
|
||||||
|
|
||||||
```batch tab=bash-batch lang=java
|
```batch tab=bash-batch lang=java
|
||||||
set PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3
|
set PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3
|
||||||
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
|
set PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```powershell tab=bash-powershell lang=java
|
```powershell tab=bash-powershell lang=java
|
||||||
$env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"
|
$env:PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST="203.0.113.3"
|
||||||
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
|
$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash tab=bash-bash lang=csharp
|
```bash tab=bash-bash lang=csharp
|
||||||
|
@ -29,7 +29,7 @@ configurations for common CI providers.
|
|||||||
playwright install --with-deps
|
playwright install --with-deps
|
||||||
```
|
```
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install --with-deps"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps"
|
||||||
```
|
```
|
||||||
```bash csharp
|
```bash csharp
|
||||||
pwsh bin/Debug/netX/playwright.ps1 install --with-deps
|
pwsh bin/Debug/netX/playwright.ps1 install --with-deps
|
||||||
@ -103,7 +103,7 @@ steps:
|
|||||||
- name: Build & Install
|
- name: Build & Install
|
||||||
run: mvn -B install -D skipTests --no-transfer-progress
|
run: mvn -B install -D skipTests --no-transfer-progress
|
||||||
- name: Install Playwright
|
- name: Install Playwright
|
||||||
run: mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install --with-deps"
|
run: mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps"
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: mvn test
|
run: mvn test
|
||||||
```
|
```
|
||||||
@ -228,7 +228,7 @@ steps:
|
|||||||
- name: Build & Install
|
- name: Build & Install
|
||||||
run: mvn -B install -D skipTests --no-transfer-progress
|
run: mvn -B install -D skipTests --no-transfer-progress
|
||||||
- name: Install Playwright
|
- name: Install Playwright
|
||||||
run: mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install --with-deps"
|
run: mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps"
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: mvn test
|
run: mvn test
|
||||||
```
|
```
|
||||||
|
@ -12,7 +12,7 @@ npx playwright --help
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -44,7 +44,7 @@ npx playwright install
|
|||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
# Running without arguments will install default browsers
|
# Running without arguments will install default browsers
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -66,7 +66,7 @@ npx playwright install webkit
|
|||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
# Install WebKit
|
# Install WebKit
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install webkit"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install webkit"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -86,7 +86,7 @@ npx playwright install --help
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install --help"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --help"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -108,7 +108,7 @@ npx playwright install-deps
|
|||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
# See command help
|
# See command help
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install-deps"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install-deps"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -128,7 +128,7 @@ npx playwright install-deps chromium
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install-deps chromium"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install-deps chromium"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -146,7 +146,7 @@ npx playwright install --with-deps chromium
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install --with-deps chromium"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps chromium"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -164,7 +164,7 @@ npx playwright codegen wikipedia.org
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen wikipedia.org"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen wikipedia.org"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -190,7 +190,7 @@ npx playwright codegen --save-storage=auth.json
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen --save-storage=auth.json"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --save-storage=auth.json"
|
||||||
# Perform authentication and exit.
|
# Perform authentication and exit.
|
||||||
# auth.json will contain the storage state.
|
# auth.json will contain the storage state.
|
||||||
```
|
```
|
||||||
@ -216,8 +216,8 @@ npx playwright codegen --load-storage=auth.json my.web.app
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="open --load-storage=auth.json my.web.app"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="open --load-storage=auth.json my.web.app"
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen --load-storage=auth.json my.web.app"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --load-storage=auth.json my.web.app"
|
||||||
# Perform authentication and exit.
|
# Perform authentication and exit.
|
||||||
# auth.json will contain the storage state.
|
# auth.json will contain the storage state.
|
||||||
```
|
```
|
||||||
@ -339,7 +339,7 @@ npx playwright open example.com
|
|||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
# Open page in Chromium
|
# Open page in Chromium
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="open example.com"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="open example.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -359,7 +359,7 @@ npx playwright wk example.com
|
|||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
# Open page in WebKit
|
# Open page in WebKit
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="wk example.com"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="wk example.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -382,7 +382,7 @@ npx playwright open --device="iPhone 11" wikipedia.org
|
|||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
# Emulate iPhone 11.
|
# Emulate iPhone 11.
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args='open --device="iPhone 11" wikipedia.org'
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args='open --device="iPhone 11" wikipedia.org'
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -404,7 +404,7 @@ npx playwright open --viewport-size=800,600 --color-scheme=dark twitter.com
|
|||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
# Emulate screen size and color scheme.
|
# Emulate screen size and color scheme.
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="open --viewport-size=800,600 --color-scheme=dark twitter.com"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="open --viewport-size=800,600 --color-scheme=dark twitter.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -428,7 +428,7 @@ npx playwright open --timezone="Europe/Rome" --geolocation="41.890221,12.492348"
|
|||||||
```bash java
|
```bash java
|
||||||
# Emulate timezone, language & location
|
# Emulate timezone, language & location
|
||||||
# Once page opens, click the "my location" button to see geolocation in action
|
# Once page opens, click the "my location" button to see geolocation in action
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args='open --timezone="Europe/Rome" --geolocation="41.890221,12.492348" --lang="it-IT" maps.google.com'
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args='open --timezone="Europe/Rome" --geolocation="41.890221,12.492348" --lang="it-IT" maps.google.com'
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -507,7 +507,7 @@ npx playwright screenshot --help
|
|||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
# See command help
|
# See command help
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="screenshot --help"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="screenshot --help"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -526,7 +526,7 @@ npx playwright screenshot \
|
|||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
# Wait 3 seconds before capturing a screenshot after page loads ('load' event fires)
|
# Wait 3 seconds before capturing a screenshot after page loads ('load' event fires)
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args='screenshot --device="iPhone 11" --color-scheme=dark --wait-for-timeout=3000 twitter.com twitter-iphone.png'
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args='screenshot --device="iPhone 11" --color-scheme=dark --wait-for-timeout=3000 twitter.com twitter-iphone.png'
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -554,7 +554,7 @@ npx playwright screenshot --full-page en.wikipedia.org wiki-full.png
|
|||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
# Capture a full page screenshot
|
# Capture a full page screenshot
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args='screenshot --full-page en.wikipedia.org wiki-full.png'
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args='screenshot --full-page en.wikipedia.org wiki-full.png'
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -578,7 +578,7 @@ npx playwright pdf https://en.wikipedia.org/wiki/PDF wiki.pdf
|
|||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
# See command help
|
# See command help
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="pdf https://en.wikipedia.org/wiki/PDF wiki.pdf"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="pdf https://en.wikipedia.org/wiki/PDF wiki.pdf"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
|
@ -17,7 +17,7 @@ npx playwright codegen demo.playwright.dev/todomvc
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen demo.playwright.dev/todomvc"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen demo.playwright.dev/todomvc"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
|
@ -13,7 +13,7 @@ npx playwright codegen demo.playwright.dev/todomvc
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen demo.playwright.dev/todomvc"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen demo.playwright.dev/todomvc"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -40,7 +40,7 @@ npx playwright codegen --viewport-size=800,600 playwright.dev
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen --viewport-size=800,600 playwright.dev"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --viewport-size=800,600 playwright.dev"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -64,7 +64,7 @@ npx playwright codegen --device="iPhone 11" playwright.dev
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args='codegen --device="iPhone 11" playwright.dev'
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args='codegen --device="iPhone 11" playwright.dev'
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -86,7 +86,7 @@ npx playwright codegen --color-scheme=dark playwright.dev
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen --color-scheme=dark playwright.dev"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --color-scheme=dark playwright.dev"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -108,7 +108,7 @@ npx playwright codegen --timezone="Europe/Rome" --geolocation="41.890221,12.4923
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args='codegen --timezone="Europe/Rome" --geolocation="41.890221,12.492348" --lang="it-IT" maps.google.com'
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args='codegen --timezone="Europe/Rome" --geolocation="41.890221,12.492348" --lang="it-IT" maps.google.com'
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -132,7 +132,7 @@ npx playwright codegen --save-storage=auth.json
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen --save-storage=auth.json"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --save-storage=auth.json"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -152,7 +152,7 @@ npx playwright codegen --load-storage=auth.json github.com/microsoft/playwright
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen --load-storage=auth.json github.com/microsoft/playwright"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen --load-storage=auth.json github.com/microsoft/playwright"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -172,7 +172,7 @@ npx playwright open --load-storage=auth.json github.com/microsoft/playwright
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="open --load-storage=auth.json github.com/microsoft/playwright"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="open --load-storage=auth.json github.com/microsoft/playwright"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
|
@ -187,7 +187,7 @@ npx playwright codegen wikipedia.org
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen wikipedia.org"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="codegen wikipedia.org"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
|
@ -79,7 +79,7 @@ public class App {
|
|||||||
With the Example.java and pom.xml above, compile and execute your new program as follows:
|
With the Example.java and pom.xml above, compile and execute your new program as follows:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mvn compile exec:java -Dexec.mainClass="org.example.App"
|
mvn compile exec:java -D exec.mainClass="org.example.App"
|
||||||
```
|
```
|
||||||
|
|
||||||
Running it downloads the Playwright package and installs browser binaries for Chromium, Firefox and WebKit. To modify this behavior see [installation parameters](./browsers.md#installing-browsers).
|
Running it downloads the Playwright package and installs browser binaries for Chromium, Firefox and WebKit. To modify this behavior see [installation parameters](./browsers.md#installing-browsers).
|
||||||
@ -115,7 +115,7 @@ playwright.firefox().launch(new BrowserType.LaunchOptions().setHeadless(false).s
|
|||||||
## Running the Example script
|
## Running the Example script
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mvn compile exec:java -Dexec.mainClass="org.example.App"
|
mvn compile exec:java -D exec.mainClass="org.example.App"
|
||||||
```
|
```
|
||||||
|
|
||||||
By default browsers launched with Playwright run headless, meaning no browser UI will open up when running the script. To change that you can pass `new BrowserType.LaunchOptions().setHeadless(false)` when launching the browser.
|
By default browsers launched with Playwright run headless, meaning no browser UI will open up when running the script. To change that you can pass `new BrowserType.LaunchOptions().setHeadless(false)` when launching the browser.
|
||||||
|
@ -692,7 +692,7 @@ npx playwright open --save-har=example.har --save-har-glob="**/api/**" https://e
|
|||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
# Save API requests from example.com as "example.har" archive.
|
# Save API requests from example.com as "example.har" archive.
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="open --save-har=example.har --save-har-glob='**/api/**' https://example.com"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="open --save-har=example.har --save-har-glob='**/api/**' https://example.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
|
@ -206,7 +206,7 @@ Now you can record network traffic into a HAR file and re-use this traffic in yo
|
|||||||
To record network into HAR file:
|
To record network into HAR file:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="open --save-har=example.har --save-har-glob='**/api/**' https://example.com"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="open --save-har=example.har --save-har-glob='**/api/**' https://example.com"
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, you can record HAR programmatically:
|
Alternatively, you can record HAR programmatically:
|
||||||
@ -520,7 +520,7 @@ Playwright Trace Viewer is now **available online** at https://trace.playwright.
|
|||||||
- Playwright now supports **Ubuntu 20.04 ARM64**. You can now run Playwright tests inside Docker on Apple M1 and on Raspberry Pi.
|
- Playwright now supports **Ubuntu 20.04 ARM64**. You can now run Playwright tests inside Docker on Apple M1 and on Raspberry Pi.
|
||||||
- You can now use Playwright to install stable version of Edge on Linux:
|
- You can now use Playwright to install stable version of Edge on Linux:
|
||||||
```bash
|
```bash
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install msedge"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install msedge"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -547,7 +547,7 @@ Read more about [`method: Locator.waitFor`].
|
|||||||
|
|
||||||
### 🎭 Playwright Trace Viewer
|
### 🎭 Playwright Trace Viewer
|
||||||
|
|
||||||
- run trace viewer with `mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="show-trace"` and drop trace files to the trace viewer PWA
|
- run trace viewer with `mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace"` and drop trace files to the trace viewer PWA
|
||||||
- better visual attribution of action targets
|
- better visual attribution of action targets
|
||||||
|
|
||||||
Read more about [Trace Viewer](./trace-viewer).
|
Read more about [Trace Viewer](./trace-viewer).
|
||||||
@ -725,7 +725,7 @@ Traces are examined later with the Playwright CLI:
|
|||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="show-trace trace.zip"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.zip"
|
||||||
```
|
```
|
||||||
|
|
||||||
That will open the following GUI:
|
That will open the following GUI:
|
||||||
@ -836,7 +836,7 @@ This version of Playwright was also tested against the following stable channels
|
|||||||
- [Selecting elements based on layout](./other-locators.md#css-matching-elements-based-on-layout) with `:left-of()`, `:right-of()`, `:above()` and `:below()`.
|
- [Selecting elements based on layout](./other-locators.md#css-matching-elements-based-on-layout) with `:left-of()`, `:right-of()`, `:above()` and `:below()`.
|
||||||
- Playwright now includes [command line interface](./cli.md), former playwright-cli.
|
- Playwright now includes [command line interface](./cli.md), former playwright-cli.
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="--help"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="--help"
|
||||||
```
|
```
|
||||||
- [`method: Page.selectOption`] now waits for the options to be present.
|
- [`method: Page.selectOption`] now waits for the options to be present.
|
||||||
- New methods to [assert element state](./actionability#assertions) like [`method: Page.isEditable`].
|
- New methods to [assert element state](./actionability#assertions) like [`method: Page.isEditable`].
|
||||||
|
@ -95,7 +95,7 @@ npx playwright show-trace trace.zip
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="show-trace trace.zip"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.zip"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
|
@ -23,7 +23,7 @@ npx playwright show-trace trace.zip
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="show-trace trace.zip"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.zip"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -263,7 +263,7 @@ npx playwright show-trace trace.zip
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="show-trace trace.zip"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace trace.zip"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
@ -290,7 +290,7 @@ npx playwright show-trace https://example.com/trace.zip
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash java
|
```bash java
|
||||||
mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="show-trace https://example.com/trace.zip"
|
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="show-trace https://example.com/trace.zip"
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash python
|
```bash python
|
||||||
|
@ -740,7 +740,7 @@ function buildBasePlaywrightCLICommand(cliTargetLang: string | undefined): strin
|
|||||||
case 'python':
|
case 'python':
|
||||||
return `playwright`;
|
return `playwright`;
|
||||||
case 'java':
|
case 'java':
|
||||||
return `mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="...options.."`;
|
return `mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="...options.."`;
|
||||||
case 'csharp':
|
case 'csharp':
|
||||||
return `pwsh bin/Debug/netX/playwright.ps1`;
|
return `pwsh bin/Debug/netX/playwright.ps1`;
|
||||||
default:
|
default:
|
||||||
|
@ -913,7 +913,7 @@ export function buildPlaywrightCLICommand(sdkLanguage: string, parameters: strin
|
|||||||
case 'python':
|
case 'python':
|
||||||
return `playwright ${parameters}`;
|
return `playwright ${parameters}`;
|
||||||
case 'java':
|
case 'java':
|
||||||
return `mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="${parameters}"`;
|
return `mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="${parameters}"`;
|
||||||
case 'csharp':
|
case 'csharp':
|
||||||
return `pwsh bin/Debug/netX/playwright.ps1 ${parameters}`;
|
return `pwsh bin/Debug/netX/playwright.ps1 ${parameters}`;
|
||||||
default:
|
default:
|
||||||
|
@ -19,7 +19,7 @@ test('codegen should print the right install command without browsers', async ({
|
|||||||
await exec('npm i --foreground-scripts playwright', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });
|
await exec('npm i --foreground-scripts playwright', { env: { PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: '1' } });
|
||||||
|
|
||||||
const pwLangName2InstallCommand = {
|
const pwLangName2InstallCommand = {
|
||||||
'java': 'mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install"',
|
'java': 'mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"',
|
||||||
'python': 'playwright install',
|
'python': 'playwright install',
|
||||||
'csharp': 'pwsh bin/Debug/netX/playwright.ps1 install',
|
'csharp': 'pwsh bin/Debug/netX/playwright.ps1 install',
|
||||||
'': 'npx playwright install',
|
'': 'npx playwright install',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user