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: add tabs for shell scripts (#9289)
Max Schmitta280a1715706
diff --git a/docs/src/browsers.md b/docs/src/browsers.mdindex d303f98685..a67d57b498 100644--- a/docs/src/browsers.md+++ b/docs/src/browsers.md@@ -225,109 +225,122 @@ 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:-```bash js-# Linux/macOS+```bash bash-flavor=bash lang=jsPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright install+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=jsset PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsersnpx playwright install+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=js$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"npx playwright install```-```bash python-# Linux/macOS+```bash bash-flavor=bash lang=pythonpip install playwrightPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python -m playwright install+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=pythonset PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browserspip install playwrightplaywright install+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=python$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"pip install playwrightplaywright install```-```bash java-# Linux/macOS+```bash bash-flavor=bash lang=javaPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers mvn test+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=javaset PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsersmvn test+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=java$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"mvn test```-```bash csharp-# Linux/macOS+```bash bash-flavor=bash lang=csharpPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsersplaywright install+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=csharpset PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsersplaywright install+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=csharp$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"playwright install```When running Playwright scripts, ask it to search for browsers in a shared location.-```bash js-# Linux/macOS+```bash bash-flavor=bash lang=jsPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npx playwright test+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=jsset PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsersnpx playwright test+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=js$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"npx playwright test```-```bash python+```bash bash-flavor=bash lang=python# Linux/macOSPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python playwright_script.py+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=pythonset PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browserspython playwright_script.py+```++```bash bash-flavor=powershell lang=python-# Windows with PowerShell$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"python playwright_script.py```-```bash java-# Windows with cmd.exe+```bash bash-flavor=bash lang=java+PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers mvn test+```++```bash bash-flavor=batch lang=javaset PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsersmvn test+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=java$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"mvn test```-```bash csharp-# Linux/macOS+```bash bash-flavor=bash lang=csharpPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers dotnet test+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=csharpset PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsersdotnet test+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=csharp$env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"dotnet test```@@ -343,17 +356,18 @@ Developers can opt-in in this mode via exporting `PLAYWRIGHT_BROWSERS_PATH=$HOMEYou can opt into the hermetic install and place binaries in the local folder:-```bash-# Linux/macOS+```bash bash-flavor=bash# Places binaries to node_modules/@playwright/testPLAYWRIGHT_BROWSERS_PATH=0 npx playwright install+```-# Windows with cmd.exe+```bash bash-flavor=batch# Places binaries to node_modules\@playwright\testset PLAYWRIGHT_BROWSERS_PATH=0npx playwright install+```-# Windows with PowerShell+```bash bash-flavor=powershell# Places binaries to node_modules\@playwright\test$env:PLAYWRIGHT_BROWSERS_PATH=0npx playwright install@@ -366,44 +380,47 @@ By default, Playwright downloads browsers from Microsoft CDN.Sometimes companies maintain an internal proxy that blocks direct access to the publicresources. In this case, Playwright can be configured to download browsers via a proxy server.-```bash python-# Linux/macOS+```bash bash-flavor=bash lang=pythonpip install playwrightHTTPS_PROXY=https://192.0.2.1 playwright install+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=pythonset HTTPS_PROXY=https://192.0.2.1pip install playwrightplaywright install+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=python$env:HTTPS_PROXY="https://192.0.2.1"pip install playwrightplaywright install```-```bash java-# Linux/macOS+```bash bash-flavor=bash lang=javaHTTPS_PROXY=https://192.0.2.1 mvn test+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=javaset HTTPS_PROXY=https://192.0.2.1mvn test+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=java$env:HTTPS_PROXY="https://192.0.2.1"mvn test```-```bash csharp-# Linux/macOS+```bash bash-flavor=bash lang=csharpHTTPS_PROXY=https://192.0.2.1 playwright install+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=csharpset HTTPS_PROXY=https://192.0.2.1playwright install+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=csharp$env:HTTPS_PROXY="https://192.0.2.1"playwright install```@@ -416,44 +433,48 @@ Sometimes companies maintain an internal artifact repository to host browserbinaries. In this case, Playwright can be configured to download from a customlocation using the `PLAYWRIGHT_DOWNLOAD_HOST` env variable.-```bash python-# Linux/macOS+```bash bash-flavor=bash lang=pythonpip install playwrightPLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 playwright install-# Windows with cmd.exe+```++```bash bash-flavor=batch lang=pythonset PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1pip install playwrightplaywright install+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=python$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"pip install playwrightplaywright install```-```bash java-# Linux/macOS+```bash bash-flavor=bash lang=javaPLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 mvn test+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=javaset PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1mvn test+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=java$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"mvn test```-```bash csharp-# Linux/macOS+```bash bash-flavor=bash lang=csharpPLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 playwright install+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=csharpset PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1playwright install+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=csharp$env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"playwright install```@@ -484,44 +505,47 @@ browser binaries are managed separately.This can be done by setting `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` variable before installation.-```bash python-# Linux/macOS+```bash bash-flavor=bash lang=pythonpip install playwrightPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 python -m playwright install+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=pythonset PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1pip install playwrightplaywright install+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=python$env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1pip install playwrightplaywright install```-```bash java-# Linux/macOS+```bash bash-flavor=bash lang=javaPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 mvn test+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=javaset PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1mvn test+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=java$env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1mvn test```-```bash csharp-# Linux/macOS+```bash bash-flavor=bash lang=csharpPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 playwright install+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=csharpset PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1playwright install+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=csharp$env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1playwright install```diff --git a/docs/src/debug.md b/docs/src/debug.mdindex e6d37f17d0..24b1fcb0f3 100644--- a/docs/src/debug.md+++ b/docs/src/debug.md@@ -111,41 +111,44 @@ Using `PWDEBUG=console` will configure the browser for debugging in Developer to[Playwright selectors](./selectors.md). This can be used to verify text orcomposite selectors.-```bash js-# Linux/macOS+```bash bash-flavor=bash lang=jsPWDEBUG=console npm run test+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=jsset PWDEBUG=consolenpm run test+```-# Windows with PowerShell-$env:PWDEBUG="console"+```bash bash-flavor=powershell lang=js+env:PWDEBUG="console"npm run test```-```bash java-# Linux/macOS+```bash bash-flavor=bash lang=javaPWDEBUG=console mvn test+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=javaset PWDEBUG=consolemvn test+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=java$env:PWDEBUG="console"mvn test```-```bash python-# Linux/macOS+```bash bash-flavor=bash lang=pythonPWDEBUG=console pytest -s+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=pythonset PWDEBUG=consolepytest -s+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=python$env:PWDEBUG="console"pytest -s```@@ -190,54 +193,58 @@ breakpoints.Playwright supports verbose logging with the `DEBUG` environment variable.-```bash js-# Linux/macOS+```bash bash-flavor=bash lang=jsDEBUG=pw:api npm run test+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=jsset DEBUG=pw:apinpm run test+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=js$env:DEBUG="pw:api"npm run test```-```bash java-# Linux/macOS+```bash bash-flavor=bash lang=javaDEBUG=pw:api mvn test+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=javaset DEBUG=pw:apimvn test+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=java$env:DEBUG="pw:api"mvn test```-```bash python-# Linux/macOS+```bash bash-flavor=bash lang=pythonDEBUG=pw:api pytest -s+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=pythonset DEBUG=pw:apipytest -s+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=python$env:DEBUG="pw:api"pytest -s```-```bash csharp-# Linux/macOS+```bash bash-flavor=bash lang=csharpDEBUG=pw:api dotnet run+```-# Windows with cmd.exe+```bash bash-flavor=batch lang=csharpset DEBUG=pw:apidotnet run+```-# Windows with PowerShell+```bash bash-flavor=powershell lang=csharp$env:DEBUG="pw:api"dotnet run-```\ No newline at end of file+```diff --git a/docs/src/inspector.md b/docs/src/inspector.mdindex 62c70c387e..3c8e4cceaf 100644--- a/docs/src/inspector.md+++ b/docs/src/inspector.md@@ -15,43 +15,47 @@ There are several ways of opening Playwright Inspector:- Set the `PWDEBUG` environment variable to run your scripts in debug mode. Thisconfigures Playwright for debugging and opens the inspector.- ```bash js- # Linux/macOS++ ```bash bash-flavor=bash lang=jsPWDEBUG=1 npm run test+ ```- # Windows with cmd.exe+ ```bash bash-flavor=batch lang=jsset PWDEBUG=1npm run test+ ```- # Windows with PowerShell+ ```bash bash-flavor=powershell lang=js$env:PWDEBUG=1npm run test```- ```bash java- # Linux/macOS+ ```bash bash-flavor=bash lang=javaPWDEBUG=1 PLAYWRIGHT_JAVA_SRC=<java src root> mvn test+ ```- # Windows with cmd.exe+ ```bash bash-flavor=batch lang=javaset PLAYWRIGHT_JAVA_SRC=<java src root>set PWDEBUG=1mvn test+ ```- # Windows with PowerShell+ ```bash bash-flavor=powershell lang=java$env:PLAYWRIGHT_JAVA_SRC="<java src root>"$env:PWDEBUG=1mvn test```- ```bash python- # Linux/macOS+ ```bash bash-flavor=bash lang=pythonPWDEBUG=1 pytest -s+ ```- # Windows with cmd.exe+ ```bash bash-flavor=batch lang=pythonset PWDEBUG=1pytest -s+ ```- # Windows with PowerShell+ ```bash bash-flavor=powershell lang=python$env:PWDEBUG=1pytest -s```diff --git a/docs/src/intro-python.md b/docs/src/intro-python.mdindex 7c9fc94dec..53b547ba78 100644--- a/docs/src/intro-python.md+++ b/docs/src/intro-python.md@@ -155,17 +155,18 @@ with sync_playwright() as p:If you want to bundle browsers with the executables:-```bash-# Linux/macOS+```bash bash-flavor=bashPLAYWRIGHT_BROWSERS_PATH=0 playwright install chromiumpyinstaller -F main.py+```-# Windows with cmd.exe+```bash bash-flavor=batchset PLAYWRIGHT_BROWSERS_PATH=0playwright install chromiumpyinstaller -F main.py+```-# Windows with PowerShell+```bash bash-flavor=powershell$env:PLAYWRIGHT_BROWSERS_PATH="0"playwright install chromiumpyinstaller -F main.pydiff --git a/docs/src/test-reporters-js.md b/docs/src/test-reporters-js.mdindex 5f1d1a8808..03089bc4e0 100644--- a/docs/src/test-reporters-js.md+++ b/docs/src/test-reporters-js.md@@ -263,15 +263,17 @@ Running 124 tests using 6 workersJSON reporter produces an object with all information about the test run. It is usually used together with some terminal reporter like `dot` or `line`.Most likely you want to write the JSON to a file. When running with `--reporter=json`, use `PLAYWRIGHT_JSON_OUTPUT_NAME` environment variable:-```bash-# Linux/macOS++```bash bash-flavor=bashPLAYWRIGHT_JSON_OUTPUT_NAME=results.json npx playwright test --reporter=json,dot+```-# Windows with cmd.exe+```bash bash-flavor=batchset PLAYWRIGHT_JSON_OUTPUT_NAME=results.jsonnpx playwright test --reporter=json,dot+```-# Windows with PowerShell+```bash bash-flavor=powershell$env:PLAYWRIGHT_JSON_OUTPUT_NAME="results.json"npx playwright test --reporter=json,dot```@@ -304,15 +306,17 @@ export default config;JUnit reporter produces a JUnit-style xml report. It is usually used together with some terminal reporter like `dot` or `line`.Most likely you want to write the report to an xml file. When running with `--reporter=junit`, use `PLAYWRIGHT_JUNIT_OUTPUT_NAME` environment variable:-```bash-# Linux/macOS++```bash bash-flavor=bashPLAYWRIGHT_JUNIT_OUTPUT_NAME=results.xml npx playwright test --reporter=junit,line+```-# Windows with cmd.exe+```bash bash-flavor=batchset PLAYWRIGHT_JUNIT_OUTPUT_NAME=results.xmlnpx playwright test --reporter=junit,line+```-# Windows with PowerShell+```bash bash-flavor=powershell$env:PLAYWRIGHT_JUNIT_OUTPUT_NAME="results.xml"npx playwright test --reporter=junit,line```