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
chore: use bash instead of sh in code blocks (#6847)
Max Schmitt79b244a2f4f4
diff --git a/browser_patches/README.md b/browser_patches/README.mdindex 9f232f59e8..df28be78bf 100644--- a/browser_patches/README.md+++ b/browser_patches/README.md@@ -25,7 +25,7 @@ and develop from there.From the `playwright` repo, run the following command:-```sh+```bash$ ./browser_patches/prepare_checkout.sh firefox <path to checkout>```(you can optionally pass "webkit" for a webkit checkout)@@ -45,7 +45,7 @@ You want to create a new branch off the `playwright-build` branch.Assuming that you're under `./browser_patches/firefox/checkout`:-```sh+```bash$ git checkout -b my-new-feature playwright-build$ # develop my feature on the my-new-feature branch ....```@@ -56,7 +56,7 @@ Once you're happy with the work you did in the browser-land, you want to exportAssuming that you're in the root of the `playwright` repo and that your browser checkout has your feature branch checked out:-```sh+```bash$ ./browser_patches/export.sh firefox <path to checkout>```@@ -73,7 +73,7 @@ Send a PR to the Playwright repo to be reviewed.Once the patch has been committed, the build bots will kick in, compile and upload a new browser version to all the platforms. Then you can roll the browser:-```sh+```bash$ node utils/roll_browser.js chromium 123456```diff --git a/docs/src/api/class-android.md b/docs/src/api/class-android.mdindex 7b569c8d46..1f0b9ab0b2 100644--- a/docs/src/api/class-android.md+++ b/docs/src/api/class-android.md@@ -62,7 +62,7 @@ const { _android: android } = require('playwright');Note that since you don't need Playwright to install web browsers when testing Android, you can omit browser download via setting the following environment variable when installing Playwright:-```sh js+```bash jsPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright```diff --git a/docs/src/api/class-electron.md b/docs/src/api/class-electron.mdindex b11abf6983..b9da050653 100644--- a/docs/src/api/class-electron.md+++ b/docs/src/api/class-electron.md@@ -41,7 +41,7 @@ const { _electron: electron } = require('playwright');Note that since you don't need Playwright to install web browsers when testing Electron, you can omit browser download via setting the following environment variable when installing Playwright:-```sh js+```bash jsPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright```diff --git a/docs/src/ci.md b/docs/src/ci.mdindex 29f7f5dc9c..a58b78d7da 100644--- a/docs/src/ci.md+++ b/docs/src/ci.md@@ -15,21 +15,21 @@ configurations for common CI providers.1. **Ensure CI agent can run browsers**: Use [our Docker image](./docker.md)in Linux agents. Windows and macOS agents do not require any additional dependencies.1. **Install Playwright**:- ```sh js+ ```bash jsnpm ci# ornpm install```- ```sh python+ ```bash pythonpip install playwrightplaywright install```1. **Run your tests**:- ```sh js+ ```bash jsnpm test```- ```sh python+ ```bash pythonpytest```@@ -344,10 +344,10 @@ configuration, against a hash of the Playwright version.Playwright supports the `DEBUG` environment variable to output debug logs during execution. Setting it to `pw:browser*` is helpful while debugging `Error: Failed to launch browser` errors.-```sh js+```bash jsDEBUG=pw:browser* npm run test```-```sh python+```bash pythonDEBUG=pw:browser* pytest```@@ -414,9 +414,9 @@ class ProgramOn Linux agents, headed execution requires [Xvfb](https://en.wikipedia.org/wiki/Xvfb) to be installed. Our [Docker image](./docker.md) and GitHub Action have Xvfb pre-installed. To run browsers in headed mode with Xvfb, add `xvfb-run` before the Node.js command.-```sh js+```bash jsxvfb-run node index.js```-```sh python+```bash pythonxvfb-run python test.py```diff --git a/docs/src/cli.md b/docs/src/cli.mdindex 24eb9fd7ac..45528ae455 100644--- a/docs/src/cli.md+++ b/docs/src/cli.md@@ -9,15 +9,15 @@ Playwright comes with the command line tools that run via `npx` or as a part of## Usage-```sh js+```bash jsnpx playwright --help```-```sh java+```bash javamvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI```-```sh python+```bash pythonplaywright```@@ -32,15 +32,15 @@ playwright## Generate code-```sh js+```bash jsnpx playwright codegen wikipedia.org```-```sh java+```bash javamvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen wikipedia.org"```-```sh python+```bash pythonplaywright codegen wikipedia.org```@@ -52,19 +52,19 @@ Run `codegen` and perform actions in the browser. Playwright CLI will generate JRun `codegen` with `--save-storage` to save [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) at the end. This is useful to separately record authentication step and reuse it later.-```sh js+```bash jsnpx playwright codegen --save-storage=auth.json# Perform authentication and exit.# auth.json will contain the storage state.```-```sh java+```bash javamvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen --save-storage=auth.json"# Perform authentication and exit.# auth.json will contain the storage state.```-```sh python+```bash pythonplaywright codegen --save-storage=auth.json# Perform authentication and exit.# auth.json will contain the storage state.@@ -72,20 +72,20 @@ playwright codegen --save-storage=auth.jsonRun with `--load-storage` to consume previously loaded storage. This way, all [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) and [localStorage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) will be restored, bringing most web apps to the authenticated state.-```sh js+```bash jsnpx playwright open --load-storage=auth.json my.web.appnpx playwright codegen --load-storage=auth.json my.web.app# Perform actions in authenticated state.```-```sh java+```bash javamvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.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"# Perform authentication and exit.# auth.json will contain the storage state.```-```sh python+```bash pythonplaywright open --load-storage=auth.json my.web.appplaywright codegen --load-storage=auth.json my.web.app# Perform actions in authenticated state.@@ -196,32 +196,32 @@ class ProgramWith `open`, you can use Playwright bundled browsers to browse web pages. Playwright provides cross-platform WebKit builds that can be used to reproduce Safari rendering across Windows, Linux and macOS.-```sh js+```bash js# Open page in Chromiumnpx playwright open example.com```-```sh java+```bash java# Open page in Chromiummvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="open example.com"```-```sh python+```bash python# Open page in Chromiumplaywright open example.com```-```sh js+```bash js# Open page in WebKitnpx playwright wk example.com```-```sh java+```bash java# Open page in WebKitmvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="wk example.com"```-```sh python+```bash python# Open page in WebKitplaywright wk example.com```@@ -229,47 +229,47 @@ playwright wk example.com### Emulate devices`open` can emulate mobile and tablet devices from the [`playwright.devices`](https://playwright.dev/docs/api/class-playwright#playwrightdevices) list.-```sh js+```bash js# Emulate iPhone 11.npx playwright open --device="iPhone 11" wikipedia.org```-```sh java+```bash java# Emulate iPhone 11.mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args='open --device="iPhone 11" wikipedia.org'```-```sh python+```bash python# Emulate iPhone 11.playwright open --device="iPhone 11" wikipedia.org```### Emulate color scheme and viewport size-```sh js+```bash js# Emulate screen size and color scheme.npx playwright open --viewport-size=800,600 --color-scheme=dark twitter.com```-```sh java+```bash java# 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"```-```sh python+```bash python# Emulate screen size and color scheme.playwright open --viewport-size=800,600 --color-scheme=dark twitter.com```### Emulate geolocation, language and timezone-```sh js+```bash js# Emulate timezone, language & location# Once page opens, click the "my location" button to see geolocation in actionnpx playwright open --timezone="Europe/Rome" --geolocation="41.890221,12.492348" --lang="it-IT" maps.google.com```-```sh java+```bash java# Emulate timezone, language & location# Once page opens, click the "my location" button to see geolocation in actionmvn 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'```-```sh python+```bash python# Emulate timezone, language & location# Once page opens, click the "my location" button to see geolocation in actionplaywright open --timezone="Europe/Rome" --geolocation="41.890221,12.492348" --lang="it-IT" maps.google.com@@ -320,22 +320,22 @@ Generates selector for the given element.## Take screenshot-```sh js+```bash js# See command helpnpx playwright screenshot --help```-```sh java+```bash java# See command helpmvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="screenshot --help"```-```sh python+```bash python# See command helpplaywright screenshot --help```-```sh js+```bash js# Wait 3 seconds before capturing a screenshot after page loads ('load' event fires)npx playwright screenshot \--device="iPhone 11" \@@ -344,12 +344,12 @@ npx playwright screenshot \twitter.com twitter-iphone.png```-```sh java+```bash java# 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'```-```sh python+```bash python# Wait 3 seconds before capturing a screenshot after page loads ('load' event fires)playwright screenshot \--device="iPhone 11" \@@ -358,17 +358,17 @@ playwright screenshot \twitter.com twitter-iphone.png```-```sh js+```bash js# Capture a full page screenshotnpx playwright screenshot --full-page en.wikipedia.org wiki-full.png```-```sh java+```bash java# Capture a full page screenshotmvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args='screenshot --full-page en.wikipedia.org wiki-full.png'```-```sh python+```bash python# Capture a full page screenshotplaywright screenshot --full-page en.wikipedia.org wiki-full.png```@@ -377,17 +377,17 @@ playwright screenshot --full-page en.wikipedia.org wiki-full.pngPDF generation only works in Headless Chromium.-```sh js+```bash js# See command helpnpx playwright pdf https://en.wikipedia.org/wiki/PDF wiki.pdf```-```sh java+```bash java# See command helpmvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="pdf https://en.wikipedia.org/wiki/PDF wiki.pdf"```-```sh python+```bash python# See command helpplaywright pdf https://en.wikipedia.org/wiki/PDF wiki.pdf```@@ -396,32 +396,32 @@ playwright pdf https://en.wikipedia.org/wiki/PDF wiki.pdfUbuntu 18.04 and Ubuntu 20.04 system dependencies can get installed automatically. This is useful for CI environments.-```sh js+```bash js# See command helpnpx playwright install-deps```-```sh java+```bash java# See command helpmvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install-deps"```-```sh python+```bash python# See command helpplaywright install-deps```You can also install the dependencies for a single browser only by passing it as an argument:-```sh js+```bash jsnpx playwright install-deps chromium```-```sh java+```bash javamvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install-deps chromium"```-```sh python+```bash pythonplaywright install-deps chromium```diff --git a/docs/src/debug.md b/docs/src/debug.mdindex 2e81e1c9ca..149a73176f 100644--- a/docs/src/debug.md+++ b/docs/src/debug.md@@ -105,7 +105,7 @@ 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.-```sh js+```bash js# Linux/macOSPWDEBUG=console npm run test@@ -118,7 +118,7 @@ $env:PWDEBUG="console"npm run test```-```sh java+```bash java# Linux/macOSPWDEBUG=console mvn test@@ -131,7 +131,7 @@ $env:PWDEBUG="console"mvn test```-```sh python+```bash python# Linux/macOSPWDEBUG=console pytest -s@@ -184,7 +184,7 @@ breakpoints.Playwright supports verbose logging with the `DEBUG` environment variable.-```sh js+```bash js# Linux/macOSDEBUG=pw:api npm run test@@ -197,7 +197,7 @@ $env:DEBUG="pw:api"npm run test```-```sh java+```bash java# Linux/macOSDEBUG=pw:api mvn test@@ -210,7 +210,7 @@ $env:DEBUG="pw:api"mvn test```-```sh python+```bash python# Linux/macOSDEBUG=pw:api pytest -s@@ -223,7 +223,7 @@ $env:DEBUG="pw:api"pytest -s```-```sh csharp+```bash csharp# Linux/macOSDEBUG=pw:api dotnet rundiff --git a/docs/src/docker.md b/docs/src/docker.mdindex 67752d948c..913e6a3381 100644--- a/docs/src/docker.md+++ b/docs/src/docker.md@@ -13,21 +13,21 @@ This image is published on [Docker Hub].### Pull the image-```sh js python csharp+```bash js python csharpdocker pull mcr.microsoft.com/playwright:focal```-```sh java+```bash javadocker pull mcr.microsoft.com/playwright/java:focal```or pinned to a specific Playwright version (recommended). Replace 1.10.0 with your Playwright version:-```sh js python csharp+```bash js python csharpdocker pull mcr.microsoft.com/playwright:v1.10.0-focal```-```sh java+```bash javadocker pull mcr.microsoft.com/playwright/java:v1.10.0-focal```@@ -39,11 +39,11 @@ By default, the Docker image will use the `root` user to run the browsers. ThisOn trusted websites, you can avoid creating a separate user and use root for it since you trust the code which will run on the browsers.-```sh js python csharp+```bash js python csharpdocker run -it --rm --ipc=host mcr.microsoft.com/playwright:focal /bin/bash```-```sh java+```bash javadocker run -it --rm --ipc=host mcr.microsoft.com/playwright/java:focal /bin/bash```@@ -51,11 +51,11 @@ docker run -it --rm --ipc=host mcr.microsoft.com/playwright/java:focal /bin/bashOn untrusted websites, it's recommended to use a separate user for launching the browsers in combination with the seccomp profile. Inside the container or if you are using the Docker image as a base image you have to use `adduser` for it.-```sh js python csharp+```bash js python csharpdocker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:focal /bin/bash```-```sh java+```bash javadocker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/java:focal /bin/bash```diff --git a/docs/src/inspector.md b/docs/src/inspector.mdindex 4c260ff3f1..584f0c563d 100644--- a/docs/src/inspector.md+++ b/docs/src/inspector.md@@ -15,7 +15,7 @@ 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.- ```sh js+ ```bash js# Linux/macOSPWDEBUG=1 npm run test@@ -28,7 +28,7 @@ configures Playwright for debugging and opens the inspector.npm run test```- ```sh java+ ```bash java# Linux/macOSPWDEBUG=1 PLAYWRIGHT_JAVA_SRC=<java src root> mvn test@@ -43,7 +43,7 @@ configures Playwright for debugging and opens the inspector.mvn test```- ```sh python+ ```bash python# Linux/macOSPWDEBUG=1 pytest -s@@ -89,15 +89,15 @@ configures Playwright for debugging and opens the inspector.- Use `open` or `codegen` commands in the Playwright [CLI](./cli.md):- ```sh js+ ```bash jsnpx playwright codegen wikipedia.org```- ```sh java+ ```bash javamvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen wikipedia.org"```- ```sh python+ ```bash pythonplaywright codegen wikipedia.org```diff --git a/docs/src/installation.md b/docs/src/installation.mdindex 560f4e03d4..a6c801322e 100644--- a/docs/src/installation.md+++ b/docs/src/installation.md@@ -13,18 +13,18 @@ Each version of Playwright needs specific versions of browser binaries to operat- `~/Library/Caches/ms-playwright` on MacOS- `~/.cache/ms-playwright` on Linux-```sh js+```bash jsnpm i -D playwright```-```sh python+```bash pythonpip install playwrightplaywright install```These browsers will take few hundreds of megabytes of the disk space when installed:-```sh+```bashdu -hs ./Library/Caches/ms-playwright/*281M chromium-XXXXXX187M firefox-XXXX@@ -33,7 +33,7 @@ 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:-```sh js+```bash js# Linux/macOSPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npm i -D playwright@@ -46,7 +46,7 @@ $env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"npm i -D playwright```-```sh python+```bash python# Linux/macOSpip install playwrightPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python -m playwright install@@ -62,14 +62,14 @@ pip install playwrightplaywright install```-```sh java+```bash java# Linux/macOSPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers mvn test```When running Playwright scripts, ask it to search for browsers in a shared location.-```sh js+```bash js# Linux/macOSPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers node playwright-script.js@@ -82,7 +82,7 @@ $env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"node playwright-script.js```-```sh python+```bash python# Linux/macOSPLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python playwright_script.js@@ -95,7 +95,7 @@ $env:PLAYWRIGHT_BROWSERS_PATH="$env:USERPROFILE\pw-browsers"python playwright_script.py```-```sh java+```bash java# Windows with cmd.exeset PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsersmvn test@@ -107,7 +107,7 @@ mvn testOr you can opt into the hermetic install and place binaries in the local folder:-```sh js+```bash js# Linux/macOS# Places binaries to node_modules/playwrightPLAYWRIGHT_BROWSERS_PATH=0 npm i -D playwright@@ -123,7 +123,7 @@ $env:PLAYWRIGHT_BROWSERS_PATH=0npm i -D playwright```-```sh python+```bash python# Linux/macOSpip install playwrightPLAYWRIGHT_BROWSERS_PATH=0 playwright install@@ -152,7 +152,7 @@ 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.-```sh js+```bash js# Linux/macOSHTTPS_PROXY=https://192.0.2.1 npm i -D playwright@@ -165,7 +165,7 @@ $env:HTTPS_PROXY="https://192.0.2.1"npm i -D playwright```-```sh python+```bash python# Linux/macOSpip install playwrightHTTPS_PROXY=https://192.0.2.1 playwright install@@ -181,7 +181,7 @@ pip install playwrightplaywright install```-```sh java+```bash java# Linux/macOSHTTPS_PROXY=https://192.0.2.1 mvn test@@ -202,7 +202,7 @@ 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.-```sh js+```bash js# Linux/macOSPLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npm i -D playwright@@ -215,7 +215,7 @@ $env:PLAYWRIGHT_DOWNLOAD_HOST="192.0.2.1"npm i -D playwright```-```sh python+```bash python# Linux/macOSpip install playwrightPLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 playwright install@@ -231,7 +231,7 @@ pip install playwrightplaywright install```-```sh java+```bash java# Linux/macOSPLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 mvn test@@ -249,18 +249,18 @@ take precedence over `PLAYWRIGHT_DOWNLOAD_HOST`.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`.-```sh js+```bash js# Linux/macOSPLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 npm i -D playwright```-```sh python+```bash python# Linux/macOSpip install playwrightPLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 python -m playwright install```-```sh java+```bash java# Linux/macOSPLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=203.0.113.3 PLAYWRIGHT_DOWNLOAD_HOST=192.0.2.1 mvn test```@@ -272,7 +272,7 @@ browser binaries are managed separately.This can be done by setting `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` variable before installation.-```sh js+```bash js# Linux/macOSPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright@@ -285,7 +285,7 @@ $env:PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1npm i -D playwright```-```sh python+```bash python# Linux/macOSpip install playwrightPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 python -m playwright install@@ -301,7 +301,7 @@ pip install playwrightplaywright install```-```sh java+```bash java# Linux/macOSPLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 mvn test@@ -330,7 +330,7 @@ Using these packages is as easy as using a regular Playwright:Install a specific package-```sh+```bashnpm i -D playwright-webkit```@@ -351,7 +351,7 @@ const { webkit } = require('playwright-webkit');Playwright downloads Chromium, Firefox and WebKit browsers by default. To install a specific browser, pass it as an argument during installation.-```sh+```bashpip install playwrightplaywright install firefox```diff --git a/docs/src/intro-csharp.md b/docs/src/intro-csharp.mdindex b050ea88dc..50e2a93729 100644--- a/docs/src/intro-csharp.md+++ b/docs/src/intro-csharp.md@@ -10,7 +10,7 @@ title: "Getting Started"Install Microsoft.Playwright package from NuGet in Visual Studio or from the CLI in your project root directory:-```sh+```bashdotnet add package Microsoft.Playwright```@@ -35,7 +35,7 @@ class ProgramCreate a console project and add the Playwright dependency.-```sh+```bashdotnet new console -n pw_democd pw_demodotnet add package Microsoft.Playwright --prerelease@@ -62,7 +62,7 @@ class ProgramNow build it and run it.-```sh+```bashdotnet builddotnet run```@@ -77,7 +77,7 @@ await playwright.Firefox.LaunchAsync(new BrowserTypeLaunchOptions { Headless = fCommand Line Interface [CLI](./cli.md) can be used to record user interactions and generate C# code.-```sh+```bash# FIXME:```diff --git a/docs/src/intro-java.md b/docs/src/intro-java.mdindex f9acd47b7e..3e469f71a9 100644--- a/docs/src/intro-java.md+++ b/docs/src/intro-java.md@@ -83,7 +83,7 @@ public class Example {With the Example.java and pom.xml above, compile and execute your new program as follows:-```sh+```bashmvn compile exec:java -Dexec.mainClass="org.example.Example"```@@ -119,7 +119,7 @@ playwright.firefox().launch(new BrowserType.LaunchOptions().setHeadless(false).sCommand Line Interface [CLI](./cli.md) can be used to record user interactions and generate Java code.-```sh+```bashmvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen wikipedia.org"```diff --git a/docs/src/intro-js.md b/docs/src/intro-js.mdindex 7476448cf0..7b20ac7cce 100644--- a/docs/src/intro-js.md+++ b/docs/src/intro-js.md@@ -10,7 +10,7 @@ title: "Getting Started"Use npm or Yarn to install Playwright in your Node.js project. See [system requirements](#system-requirements).-```sh+```bashnpm i -D playwright```@@ -65,7 +65,7 @@ firefox.launch({ headless: false, slowMo: 50 });Command Line Interface [CLI](./cli.md) can be used to record user interactions and generate JavaScript code.-```sh+```bashnpx playwright codegen wikipedia.org```diff --git a/docs/src/intro-python.md b/docs/src/intro-python.mdindex 405bac57a2..4a31ef8c89 100644--- a/docs/src/intro-python.md+++ b/docs/src/intro-python.md@@ -10,7 +10,7 @@ title: "Getting Started"Use pip to install Playwright in your Python project. See [system requirements](#system-requirements).-```sh+```bashpip install playwrightplaywright install```@@ -74,7 +74,7 @@ firefox.launch(headless=False, slow_mo=50)Command Line Interface [CLI](./cli.md) can be used to record user interactions and generate Python code.-```sh+```bashplaywright codegen wikipedia.org```diff --git a/docs/src/release-notes.md b/docs/src/release-notes.mdindex 92c4ff2e42..cf30f58731 100644--- a/docs/src/release-notes.md+++ b/docs/src/release-notes.md@@ -83,10 +83,10 @@ This version of Playwright was also tested against the following stable channels- [Selecting elements based on layout](./selectors.md#selecting-elements-based-on-layout) with `:left-of()`, `:right-of()`, `:above()` and `:below()`.- Playwright now includes [command line interface](./cli.md), former playwright-cli.- ```sh js+ ```bash jsnpx playwright --help```- ```sh python+ ```bash pythonplaywright --help```- [`method: Page.selectOption`] now waits for the options to be present.diff --git a/docs/src/test-advanced.md b/docs/src/test-advanced.mdindex 4fc27419be..8b9fe343c8 100644--- a/docs/src/test-advanced.md+++ b/docs/src/test-advanced.md@@ -111,7 +111,7 @@ Each project can be configured separately, and run different set of tests with dSupported options are `name`, `outputDir`, `repeatEach`, `retries`, `snapshotDir`, `testDir`, `testIgnore`, `testMatch` and `timeout`. See [configuration object](#configuration-object) for detailed description.You can run all projects or just a single one:-```sh+```bash# Run both projects - each test will be run twicenpx playwright testdiff --git a/docs/src/test-cli.md b/docs/src/test-cli.mdindex 08b1025696..8a801f509a 100644--- a/docs/src/test-cli.md+++ b/docs/src/test-cli.md@@ -3,7 +3,7 @@ id: test-clititle: "Advanced: command line"----```sh+```bash# Ask for help!npx playwright test --help```diff --git a/docs/src/test-configuration.md b/docs/src/test-configuration.mdindex 3c86fd907b..32655466f5 100644--- a/docs/src/test-configuration.md+++ b/docs/src/test-configuration.md@@ -68,13 +68,13 @@ export default config;Now run tests as usual, Playwright Test will pick up the configuration file automatically.-```sh+```bashnpx playwright test --browser=firefox```If you put your configuration file in a different place, pass it with `--config` option.-```sh+```bashnpx playwright test --config=tests/my.config.js```@@ -276,7 +276,7 @@ export default config;Playwright Test will run all projects by default.-```sh+```bash$ npx playwright testRunning 3 tests using 3 workers@@ -288,7 +288,7 @@ Running 3 tests using 3 workersUse `--project` command line option to run a single project.-```sh+```bash$ npx playwright test --project=webkitRunning 1 test using 1 workerdiff --git a/docs/src/test-intro.md b/docs/src/test-intro.mdindex bda31fdd51..a6c2833862 100644--- a/docs/src/test-intro.md+++ b/docs/src/test-intro.md@@ -21,7 +21,7 @@ Playwright Test Runner was created specifically to accommodate the needs of thePlaywright already includes a test runner for end-to-end tests.-```sh+```bashnpm i -D playwright```@@ -51,25 +51,25 @@ test('basic test', async ({ page }) => {Now run your tests, assuming that test files are in the `tests` directory.-```sh+```bashnpx playwright test -c tests```Playwright Test just ran a test using Chromium browser, in a headless manner. Let's tell it to use headed browser:-```sh+```bashnpx playwright test -c tests --headed```What about other browsers? Let's run the same test using Firefox:-```sh+```bashnpx playwright test -c tests --browser=firefox```And finally, on all three browsers:-```sh+```bashnpx playwright test -c tests --browser=all```@@ -273,47 +273,47 @@ test('my test', async ({ page }) => {Here are the most common options available in the [command line](./test-cli.md).- Run tests in headed browsers- ```sh+ ```bashnpx playwright test --headed```- Run tests in a particular browser- ```sh+ ```bashnpx playwright test --browser=webkit```- Run tests in all browsers- ```sh+ ```bashnpx playwright test --browser=all```- Run a single test file- ```sh+ ```bashnpx playwright test tests/todo-page.spec.ts```- Run a set of test files- ```sh+ ```bashnpx playwright test tests/todo-page/ tests/landing-page/```- Run a test with specific title- ```sh+ ```bashnpx playwright test -g "add a todo item"```- Run tests [in parallel](./test-parallel.md) - that's the default- ```sh+ ```bashnpx playwright test```- Disable [parallelization](./test-parallel.md)- ```sh+ ```bashnpx playwright test --workers=1```- Choose a [reporter](./test-reporters.md)- ```sh+ ```bashnpx playwright test --reporter=dot```diff --git a/docs/src/test-parallel.md b/docs/src/test-parallel.mdindex 37eea4b179..3d1f3552ca 100644--- a/docs/src/test-parallel.md+++ b/docs/src/test-parallel.md@@ -16,17 +16,17 @@ However, test runner will create a new worker when retrying tests, after any tesYou can control the maximum number of worker processes via [command line](./test-cli.md) or in the [configuration file](./test-configuration.md).- Run in parallel by default- ```sh+ ```bashnpx playwright test```- Disable parallelization- ```sh+ ```bashnpx playwright test --worker 1```- Control the number of workers- ```sh+ ```bashnpx playwright test --worker 4```@@ -56,7 +56,7 @@ Each worker process is assigned a unique sequential index that is accessible thrPlaywright Test can shard a test suite, so that it can be executed on multiple machines. For that, pass `--shard=x/y` to the command line. For example, to split the suite into three shards, each running one third of the tests:-```sh+```bashnpx playwright test --shard=1/3npx playwright test --shard=2/3npx playwright test --shard=3/3diff --git a/docs/src/test-reporters.md b/docs/src/test-reporters.mdindex dbdb4e83b1..f87e99420a 100644--- a/docs/src/test-reporters.md+++ b/docs/src/test-reporters.md@@ -10,7 +10,7 @@ title: "Reporters"Playwright Test comes with a few built-in reporters for different needs and ability to provide custom reporters. The easiest way to try out built-in reporters is to pass `--reporter` [command line option](./cli.md).-```sh+```bashnpx playwright test --reporter=line```@@ -68,7 +68,7 @@ All built-in reporters show detailed information about failures, and mostly diffList reporter is default. It prints a line for each test being run.-```sh+```bashnpx playwright test --reporter=list```@@ -90,7 +90,7 @@ export default config;```Here is an example output in the middle of a test run. Failures will be listed at the end.-```sh+```bashnpx playwright test --reporter=listRunning 124 tests using 6 workers@@ -110,7 +110,7 @@ Running 124 tests using 6 workersLine reporter is more concise than the list reporter. It uses a single line to report last finished test, and prints failures when they occur. Line reporter is useful for large test suites where it shows the progress but does not spam the output by listing all the tests.-```sh+```bashnpx playwright test --reporter=line```@@ -132,7 +132,7 @@ export default config;```Here is an example output in the middle of a test run. Failures are reported inline.-```sh+```bashnpx playwright test --reporter=lineRunning 124 tests using 6 workers1) dot-reporter.spec.ts:20:1 › render expected ===================================================@@ -149,7 +149,7 @@ Running 124 tests using 6 workersDot reporter is very concise - it only produces a single character per successful test run. It is useful on CI where you don't want a lot of output.-```sh+```bashnpx playwright test --reporter=dot```@@ -171,7 +171,7 @@ export default config;```Here is an example output in the middle of a test run. Failures will be listed at the end.-```sh+```bashnpx playwright test --reporter=dotRunning 124 tests using 6 workers······F·············································@@ -182,7 +182,7 @@ 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:-```sh+```bashPLAYWRIGHT_JSON_OUTPUT_NAME=results.json npx playwright test --reporter=json,dot```@@ -209,7 +209,7 @@ 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:-```sh+```bashPLAYWRIGHT_JUNIT_OUTPUT_NAME=results.xml npx playwright test --reporter=junit,line```diff --git a/docs/src/test-retries.md b/docs/src/test-retries.mdindex 99160e9a23..3b0674a601 100644--- a/docs/src/test-retries.md+++ b/docs/src/test-retries.md@@ -5,7 +5,7 @@ title: "Test retry"Playwright Test will retry tests if they failed. Pass the maximum number of retries when running the tests, or set them in the [configuration file](./test-configuration.md).-```sh+```bashnpx playwright test --retries=3```@@ -28,7 +28,7 @@ export default config;Failing tests will be retried multiple times until they pass, or until the maximum number of retries is reached. Playwright Test will report all tests that failed at least once.-```sh+```bashRunning 1 test using 1 worker××±1 flakydiff --git a/docs/src/test-runners-java.md b/docs/src/test-runners-java.mdindex 6e47f9a0af..44cfe237e9 100644--- a/docs/src/test-runners-java.md+++ b/docs/src/test-runners-java.md@@ -179,7 +179,7 @@ class Test2 extends TestFixtures {Configure JUnit to run tests in each class sequentially and run multiple classes on parallel threads (with maxnumber of thread equal to 1/2 of the number of CPU cores):-```sh+```bashjunit.jupiter.execution.parallel.enabled = truejunit.jupiter.execution.parallel.mode.default = same_threadjunit.jupiter.execution.parallel.mode.classes.default = concurrentdiff --git a/docs/src/test-runners-python.md b/docs/src/test-runners-python.mdindex bdc350e3f4..da1f63bfdc 100644--- a/docs/src/test-runners-python.md+++ b/docs/src/test-runners-python.md@@ -10,7 +10,7 @@ in Python.## Usage-```sh+```bashpip install pytest-playwright```@@ -25,7 +25,7 @@ def test_example_is_working(page):To run your tests, use pytest CLI.-```sh+```bash# Run tests (Chromium and headless by default)pytest@@ -113,7 +113,7 @@ def test_visit_example(page):Start Pytest with the `base-url` argument.-```sh+```bashpytest --base-url http://localhost:8080```diff --git a/docs/src/test-snapshots.md b/docs/src/test-snapshots.mdindex 10f3edf658..9f130b3248 100644--- a/docs/src/test-snapshots.md+++ b/docs/src/test-snapshots.md@@ -27,7 +27,7 @@ test('example test', async ({ page }) => {Sometimes you need to update the reference screenshot, for example when the page has changed. Do this with the `--update-snapshots` flag.-```sh+```bashnpx playwright test --update-snapshots```diff --git a/docs/src/why-playwright.md b/docs/src/why-playwright.mdindex 91eafd4525..ce30e1b412 100644--- a/docs/src/why-playwright.md+++ b/docs/src/why-playwright.md@@ -37,10 +37,10 @@ Playwright enables fast, reliable and capable automation across all modern brows## Integrates with your workflow* **One-line installation**. Installing Playwright auto-downloads browser dependencies for your team to be onboarded quickly.- ```sh js+ ```bash jsnpm i playwright```- ```sh python+ ```bash pythonpip install playwrightplaywright install```diff --git a/packages/README.md b/packages/README.mdindex 9851a57d04..c46e765e9b 100644--- a/packages/README.md+++ b/packages/README.md@@ -25,13 +25,13 @@ As of May 20, 2020, [`//packages/build_package.js`](./build_package.js) does theTo build `playwright` package and save result as `./playwright.tgz` file:-```sh+```bash./packages/build_package.js playwright ./playwright.tgz```To debug what files are put into the folder, use `--no-cleanup` flag and inspect the package folder:-```sh+```bash./packages/build_package.js playwright ./playwright.tgz --no-cleanupls ./packages/playwright # inspect the folder```diff --git a/types/types.d.ts b/types/types.d.tsindex 80078214a0..8639414078 100644--- a/types/types.d.ts+++ b/types/types.d.ts@@ -7933,7 +7933,7 @@ export {};* Note that since you don't need Playwright to install web browsers when testing Android, you can omit browser download* via setting the following environment variable when installing Playwright:*- * ```sh js+ * ```bash js* PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright* ```*@@ -9583,7 +9583,7 @@ export interface Download {* Note that since you don't need Playwright to install web browsers when testing Electron, you can omit browser download* via setting the following environment variable when installing Playwright:*- * ```sh js+ * ```bash js* PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright* ```*diff --git a/utils/generate_types/index.js b/utils/generate_types/index.jsindex 100e9e9516..a185f1e37a 100644--- a/utils/generate_types/index.js+++ b/utils/generate_types/index.js@@ -283,7 +283,7 @@ function writeComment(comment, indent = '') {const match = line.match(/```(\w+)/);if (match) {const lang = match[1];- skipExample = !["html", "yml", "sh", "js"].includes(lang);+ skipExample = !["html", "yml", "bash", "js"].includes(lang);} else if (skipExample && line.trim().startsWith('```')) {skipExample = false;continue;diff --git a/utils/linux-browser-dependencies/README.md b/utils/linux-browser-dependencies/README.mdindex 4987b429b7..3d769bfaab 100644--- a/utils/linux-browser-dependencies/README.md+++ b/utils/linux-browser-dependencies/README.md@@ -12,7 +12,7 @@ and shared libraries it provides, per distribution.To generate a map of browser library to package name on Ubuntu:bionic:-```sh+```bash./run.sh ubuntu:bionic```