From e0aaef5eab1c699b8919c3b025ab1ddcfe87290f Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 11 May 2021 20:47:48 +0200 Subject: [PATCH] docs: get rid of dollar sign prefix in code snippets (#6494) --- docs/src/api/class-android.md | 2 +- docs/src/api/class-electron.md | 2 +- docs/src/browsers.md | 8 +- docs/src/ci.md | 12 +- docs/src/cli.md | 90 +++++++------- docs/src/debug.md | 36 +++--- docs/src/docker.md | 8 +- docs/src/inspector.md | 26 ++-- docs/src/installation.md | 138 ++++++++++----------- docs/src/intro-java.md | 2 +- docs/src/intro-js.md | 4 +- docs/src/intro-python.md | 6 +- docs/src/release-notes.md | 4 +- docs/src/test-runners-python.md | 12 +- docs/src/why-playwright.md | 6 +- packages/README.md | 6 +- types/types.d.ts | 4 +- utils/linux-browser-dependencies/README.md | 2 +- 18 files changed, 184 insertions(+), 184 deletions(-) diff --git a/docs/src/api/class-android.md b/docs/src/api/class-android.md index 9c42a750cf..7b569c8d46 100644 --- a/docs/src/api/class-android.md +++ b/docs/src/api/class-android.md @@ -63,7 +63,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 -$ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright +PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright ``` ## async method: Android.devices diff --git a/docs/src/api/class-electron.md b/docs/src/api/class-electron.md index d1c8283217..46fa2f9fda 100644 --- a/docs/src/api/class-electron.md +++ b/docs/src/api/class-electron.md @@ -42,7 +42,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 -$ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright +PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright ``` ## async method: Electron.launch diff --git a/docs/src/browsers.md b/docs/src/browsers.md index fff554ecab..2b914fde52 100644 --- a/docs/src/browsers.md +++ b/docs/src/browsers.md @@ -22,7 +22,7 @@ on when to opt into stable channels, refer to the [Google Chrome & Microsoft Edg ## Firefox Playwright's Firefox version matches the recent [Firefox Beta](https://www.mozilla.org/en-US/firefox/channel/desktop/) -build. +build. ### Firefox-Stable @@ -32,15 +32,15 @@ Using `firefox-stable` is a 2-steps process: 1. Installing `firefox-stable` with Playwright CLI. ```sh js - $ npx playwright install firefox-stable + npx playwright install firefox-stable ``` ```sh java - $ mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install firefox-stable" + mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install firefox-stable" ``` ```sh python - $ playwright install firefox-stable + playwright install firefox-stable ``` 2. Using `firefox-stable` channel when launching browser. diff --git a/docs/src/ci.md b/docs/src/ci.md index 9cffc51215..d7541e747f 100644 --- a/docs/src/ci.md +++ b/docs/src/ci.md @@ -16,21 +16,21 @@ configurations for common CI providers. in Linux agents. Windows and macOS agents do not require any additional dependencies. 1. **Install Playwright**: ```sh js - $ npm ci + npm ci # or - $ npm install + npm install ``` ```sh python - $ pip install playwright - $ playwright install + pip install playwright + playwright install ``` 1. **Run your tests**: ```sh js - $ npm test + npm test ``` ```sh python - $ pytest + pytest ``` ## CI configurations diff --git a/docs/src/cli.md b/docs/src/cli.md index 4f4bff9f71..7809558c41 100644 --- a/docs/src/cli.md +++ b/docs/src/cli.md @@ -10,15 +10,15 @@ Playwright comes with the command line tools that run via `npx` or as a part of ## Usage ```sh js -$ npx playwright --help +npx playwright --help ``` ```sh java -$ mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI +mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI ``` ```sh python -$ playwright +playwright ``` ```json js @@ -33,15 +33,15 @@ $ playwright ## Generate code ```sh js -$ npx playwright codegen wikipedia.org +npx playwright codegen wikipedia.org ``` ```sh java -$ mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen wikipedia.org" +mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen wikipedia.org" ``` ```sh python -$ playwright codegen wikipedia.org +playwright codegen wikipedia.org ``` Run `codegen` and perform actions in the browser. Playwright CLI will generate JavaScript code for the user interactions. `codegen` will attempt to generate resilient text-based selectors. @@ -53,19 +53,19 @@ Run `codegen` and perform actions in the browser. Playwright CLI will generate J Run `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 -$ npx playwright codegen --save-storage=auth.json +npx playwright codegen --save-storage=auth.json # Perform authentication and exit. # auth.json will contain the storage state. ``` ```sh java -$ mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen --save-storage=auth.json" +mvn 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 -$ playwright codegen --save-storage=auth.json +playwright codegen --save-storage=auth.json # Perform authentication and exit. # auth.json will contain the storage state. ``` @@ -73,21 +73,21 @@ $ playwright codegen --save-storage=auth.json Run 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 -$ npx playwright open --load-storage=auth.json my.web.app -$ npx playwright codegen --load-storage=auth.json my.web.app +npx playwright open --load-storage=auth.json my.web.app +npx playwright codegen --load-storage=auth.json my.web.app # Perform actions in authenticated state. ``` ```sh 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 -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen --load-storage=auth.json my.web.app" +mvn 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 -$ playwright open --load-storage=auth.json my.web.app -$ playwright codegen --load-storage=auth.json my.web.app +playwright open --load-storage=auth.json my.web.app +playwright codegen --load-storage=auth.json my.web.app # Perform actions in authenticated state. ``` @@ -175,32 +175,32 @@ With `open`, you can use Playwright bundled browsers to browse web pages. Playwr ```sh js # Open page in Chromium -$ npx playwright open example.com +npx playwright open example.com ``` ```sh java # Open page in Chromium -$ mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="open example.com" +mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="open example.com" ``` ```sh python # Open page in Chromium -$ playwright open example.com +playwright open example.com ``` ```sh js # Open page in WebKit -$ npx playwright wk example.com +npx playwright wk example.com ``` ```sh java # Open page in WebKit -$ mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="wk example.com" +mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="wk example.com" ``` ```sh python # Open page in WebKit -$ playwright wk example.com +playwright wk example.com ``` ### Emulate devices @@ -208,48 +208,48 @@ $ playwright wk example.com ```sh js # Emulate iPhone 11. -$ npx playwright open --device="iPhone 11" wikipedia.org +npx playwright open --device="iPhone 11" wikipedia.org ``` ```sh java # 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 -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args='open --device="iPhone 11" wikipedia.org' ``` ```sh python # Emulate iPhone 11. -$ playwright open --device="iPhone 11" wikipedia.org +playwright open --device="iPhone 11" wikipedia.org ``` ### Emulate color scheme and viewport size ```sh js # Emulate screen size and color scheme. -$ npx playwright open --viewport-size=800,600 --color-scheme=dark twitter.com +npx playwright open --viewport-size=800,600 --color-scheme=dark twitter.com ``` ```sh 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" +mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="open --viewport-size=800,600 --color-scheme=dark twitter.com" ``` ```sh python # Emulate screen size and color scheme. -$ playwright open --viewport-size=800,600 --color-scheme=dark twitter.com +playwright open --viewport-size=800,600 --color-scheme=dark twitter.com ``` ### Emulate geolocation, language and timezone ```sh js # Emulate timezone, language & location # Once page opens, click the "my location" button to see geolocation in action -$ npx playwright open --timezone="Europe/Rome" --geolocation="41.890221,12.492348" --lang="it-IT" maps.google.com +npx playwright open --timezone="Europe/Rome" --geolocation="41.890221,12.492348" --lang="it-IT" maps.google.com ``` ```sh java # Emulate timezone, language & location # 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 -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 # Emulate timezone, language & location # Once page opens, click the "my location" button to see geolocation in action -$ playwright open --timezone="Europe/Rome" --geolocation="41.890221,12.492348" --lang="it-IT" maps.google.com +playwright open --timezone="Europe/Rome" --geolocation="41.890221,12.492348" --lang="it-IT" maps.google.com ``` ## Inspect selectors @@ -299,22 +299,22 @@ Generates selector for the given element. ```sh js # See command help -$ npx playwright screenshot --help +npx playwright screenshot --help ``` ```sh java # See command help -$ mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="screenshot --help" +mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="screenshot --help" ``` ```sh python # See command help -$ playwright screenshot --help +playwright screenshot --help ``` ```sh js # Wait 3 seconds before capturing a screenshot after page loads ('load' event fires) -$ npx playwright screenshot \ +npx playwright screenshot \ --device="iPhone 11" \ --color-scheme=dark \ --wait-for-timeout=3000 \ @@ -323,12 +323,12 @@ $ npx playwright screenshot \ ```sh 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' +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 # Wait 3 seconds before capturing a screenshot after page loads ('load' event fires) -$ playwright screenshot \ +playwright screenshot \ --device="iPhone 11" \ --color-scheme=dark \ --wait-for-timeout=3000 \ @@ -337,17 +337,17 @@ $ playwright screenshot \ ```sh js # Capture a full page screenshot -$ npx playwright screenshot --full-page en.wikipedia.org wiki-full.png +npx playwright screenshot --full-page en.wikipedia.org wiki-full.png ``` ```sh java # 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 -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args='screenshot --full-page en.wikipedia.org wiki-full.png' ``` ```sh python # Capture a full page screenshot -$ playwright screenshot --full-page en.wikipedia.org wiki-full.png +playwright screenshot --full-page en.wikipedia.org wiki-full.png ``` ## Generate PDF @@ -356,17 +356,17 @@ PDF generation only works in Headless Chromium. ```sh js # See command help -$ npx playwright pdf https://en.wikipedia.org/wiki/PDF wiki.pdf +npx playwright pdf https://en.wikipedia.org/wiki/PDF wiki.pdf ``` ```sh java # 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 -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="pdf https://en.wikipedia.org/wiki/PDF wiki.pdf" ``` ```sh python # See command help -$ playwright pdf https://en.wikipedia.org/wiki/PDF wiki.pdf +playwright pdf https://en.wikipedia.org/wiki/PDF wiki.pdf ``` ## Install system dependencies @@ -375,17 +375,17 @@ Ubuntu 18.04 and Ubuntu 20.04 system dependencies can get installed automaticall ```sh js # See command help -$ npx playwright install-deps +npx playwright install-deps ``` ```sh java # See command help -$ mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install-deps" +mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="install-deps" ``` ```sh python # See command help -$ playwright install-deps +playwright install-deps ``` ## Known limitations diff --git a/docs/src/debug.md b/docs/src/debug.md index ccfbc90cf5..7a00b2c612 100644 --- a/docs/src/debug.md +++ b/docs/src/debug.md @@ -90,29 +90,29 @@ composite selectors. ```sh js # Linux/macOS -$ PWDEBUG=console npm run test +PWDEBUG=console npm run test # Windows -$ set PWDEBUG=console -$ npm run test +set PWDEBUG=console +npm run test ``` ```sh java # Linux/macOS -$ PWDEBUG=console mvn test +PWDEBUG=console mvn test # Windows -$ set PWDEBUG=console -$ mvn test +set PWDEBUG=console +mvn test ``` ```sh python # Linux/macOS -$ PWDEBUG=console pytest -s +PWDEBUG=console pytest -s # Windows -$ set PWDEBUG=console -$ pytest -s +set PWDEBUG=console +pytest -s ``` ## Selectors in Developer Tools Console @@ -157,27 +157,27 @@ Playwright supports verbose logging with the `DEBUG` environment variable. ```sh js # Linux/macOS -$ DEBUG=pw:api npm run test +DEBUG=pw:api npm run test # Windows -$ set DEBUG=pw:api -$ npm run test +set DEBUG=pw:api +npm run test ``` ```sh java # Linux/macOS -$ DEBUG=pw:api mvn test +DEBUG=pw:api mvn test # Windows -$ set DEBUG=pw:api -$ mvn test +set DEBUG=pw:api +mvn test ``` ```sh python # Linux/macOS -$ DEBUG=pw:api pytest -s +DEBUG=pw:api pytest -s # Windows -$ set DEBUG=pw:api -$ pytest -s +set DEBUG=pw:api +pytest -s ``` diff --git a/docs/src/docker.md b/docs/src/docker.md index a5e2d330da..67752d948c 100644 --- a/docs/src/docker.md +++ b/docs/src/docker.md @@ -52,11 +52,11 @@ docker run -it --rm --ipc=host mcr.microsoft.com/playwright/java:focal /bin/bash On 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 -$ docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:focal /bin/bash +docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright:focal /bin/bash ``` ```sh java -$ docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/java:focal /bin/bash +docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/java:focal /bin/bash ``` [`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/master/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions: @@ -124,11 +124,11 @@ Browser builds for Firefox and WebKit are built for the [glibc](https://en.wikip Use [`//utils/docker/build.sh`](https://github.com/microsoft/playwright/blob/master/utils/docker/build.sh) to build the image. ``` -$ ./utils/docker/build.sh focal playwright:localbuild-focal +./utils/docker/build.sh focal playwright:localbuild-focal ``` The image will be tagged as `playwright:localbuild-focal` and could be run as: ``` -$ docker run --rm -it playwright:localbuild /bin/bash +docker run --rm -it playwright:localbuild /bin/bash ``` diff --git a/docs/src/inspector.md b/docs/src/inspector.md index 908868846e..659aa91b4e 100644 --- a/docs/src/inspector.md +++ b/docs/src/inspector.md @@ -17,30 +17,30 @@ There are several ways of opening Playwright Inspector: configures Playwright for debugging and opens the inspector. ```sh js # Linux/macOS - $ PWDEBUG=1 npm run test + PWDEBUG=1 npm run test # Windows - $ set PWDEBUG=1 - $ npm run test + set PWDEBUG=1 + npm run test ``` ```sh java # Linux/macOS - $ PWDEBUG=1 PLAYWRIGHT_JAVA_SRC= mvn test + PWDEBUG=1 PLAYWRIGHT_JAVA_SRC= mvn test # Windows - $ set PLAYWRIGHT_JAVA_SRC= - $ set PWDEBUG=1 - $ mvn test + set PLAYWRIGHT_JAVA_SRC= + set PWDEBUG=1 + mvn test ``` ```sh python # Linux/macOS - $ PWDEBUG=1 pytest -s + PWDEBUG=1 pytest -s # Windows - $ set PWDEBUG=1 - $ pytest -s + set PWDEBUG=1 + pytest -s ``` Additional useful defaults are configured when `PWDEBUG=1` is set: @@ -71,15 +71,15 @@ configures Playwright for debugging and opens the inspector. - Use `open` or `codegen` commands in the Playwright [CLI](./cli.md): ```sh js - $ npx playwright codegen wikipedia.org + npx playwright codegen wikipedia.org ``` ```sh java - $ mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen wikipedia.org" + mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen wikipedia.org" ``` ```sh python - $ playwright codegen wikipedia.org + playwright codegen wikipedia.org ``` ## Stepping through the Playwright script diff --git a/docs/src/installation.md b/docs/src/installation.md index 8724b63876..3c49a5ea8b 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -14,18 +14,18 @@ Each version of Playwright needs specific versions of browser binaries to operat - `~/.cache/ms-playwright` on Linux ```sh js -$ npm i -D playwright +npm i -D playwright ``` ```sh python -$ pip install playwright -$ playwright install +pip install playwright +playwright install ``` These browsers will take few hundreds of megabytes of the disk space when installed: ```sh -$ du -hs ./Library/Caches/ms-playwright/* +du -hs ./Library/Caches/ms-playwright/* 281M chromium-XXXXXX 187M firefox-XXXX 180M webkit-XXXX @@ -35,53 +35,53 @@ You can override default behavior using environment variables. When installing P ```sh js # Linux/macOS -$ PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npm i -D playwright +PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers npm i -D playwright # Windows -$ set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers -$ npm i -D playwright +set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers +npm i -D playwright ``` ```sh python # Linux/macOS -$ pip install playwright -$ PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python -m playwright install +pip install playwright +PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python -m playwright install # Windows -$ set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers -$ pip install playwright -$ playwright install +set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers +pip install playwright +playwright install ``` ```sh java # Linux/macOS -$ PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers mvn test +PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers mvn test ``` When running Playwright scripts, ask it to search for browsers in a shared location. ```sh js # Linux/macOS -$ PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers node playwright-script.js +PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers node playwright-script.js # Windows -$ set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers -$ node playwright-script.js +set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers +node playwright-script.js ``` ```sh python # Linux/macOS -$ PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python playwright_script.js +PLAYWRIGHT_BROWSERS_PATH=$HOME/pw-browsers python playwright_script.js # Windows -$ set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers -$ python playwright_script.py +set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers +python playwright_script.py ``` ```sh java # Windows -$ set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers -$ mvn test +set PLAYWRIGHT_BROWSERS_PATH=%USERPROFILE%\pw-browsers +mvn test ``` Or you can opt into the hermetic install and place binaries in the local folder: @@ -89,23 +89,23 @@ Or you can opt into the hermetic install and place binaries in the local folder: ```sh js # Linux/macOS # Places binaries to node_modules/playwright -$ PLAYWRIGHT_BROWSERS_PATH=0 npm i -D playwright +PLAYWRIGHT_BROWSERS_PATH=0 npm i -D playwright # Windows # Places binaries to node_modules\playwright -$ set PLAYWRIGHT_BROWSERS_PATH=0 -$ npm i -D playwright +set PLAYWRIGHT_BROWSERS_PATH=0 +npm i -D playwright ``` ```sh python # Linux/macOS -$ pip install playwright -$ PLAYWRIGHT_BROWSERS_PATH=0 playwright install +pip install playwright +PLAYWRIGHT_BROWSERS_PATH=0 playwright install # Windows -$ set PLAYWRIGHT_BROWSERS_PATH=0 -$ pip install playwright -$ playwright install +set PLAYWRIGHT_BROWSERS_PATH=0 +pip install playwright +playwright install ``` Playwright keeps track of packages that need those browsers and will garbage collect them as you update Playwright to the newer versions. @@ -123,31 +123,31 @@ resources. In this case, Playwright can be configured to download browsers via a ```sh js # Linux/macOS -$ HTTPS_PROXY=https://192.168.1.78 npm i -D playwright +HTTPS_PROXY=https://192.168.1.78 npm i -D playwright # Windows -$ set HTTPS_PROXY=https://192.168.1.78 -$ npm i -D playwright +set HTTPS_PROXY=https://192.168.1.78 +npm i -D playwright ``` ```sh python # Linux/macOS -$ pip install playwright -$ HTTPS_PROXY=https://192.168.1.78 playwright install +pip install playwright +HTTPS_PROXY=https://192.168.1.78 playwright install # Windows -$ set HTTPS_PROXY=https://192.168.1.78 -$ pip install playwright -$ playwright install +set HTTPS_PROXY=https://192.168.1.78 +pip install playwright +playwright install ``` ```sh java # Linux/macOS -$ HTTPS_PROXY=https://192.168.1.78 mvn test +HTTPS_PROXY=https://192.168.1.78 mvn test # Windows -$ set HTTPS_PROXY=https://192.168.1.78 -$ mvn test +set HTTPS_PROXY=https://192.168.1.78 +mvn test ``` ## Download from artifact repository @@ -160,31 +160,31 @@ location using the `PLAYWRIGHT_DOWNLOAD_HOST` env variable. ```sh js # Linux/macOS -$ PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 npm i -D playwright +PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 npm i -D playwright # Windows -$ set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 -$ npm i -D playwright +set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 +npm i -D playwright ``` ```sh python # Linux/macOS -$ pip install playwright -$ PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 playwright install +pip install playwright +PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 playwright install # Windows -$ set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 -$ pip install playwright -$ playwright install +set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 +pip install playwright +playwright install ``` ```sh java # Linux/macOS -$ PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 mvn test +PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 mvn test # Windows -$ set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 -$ mvn test +set PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 +mvn test ``` It is also possible to use a per-browser download hosts using `PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST`, `PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST` and `PLAYWRIGHT_WEBKIT_DOWNLOAD_HOST` env variables that @@ -194,18 +194,18 @@ It is also possible to use a per-browser download hosts using `PLAYWRIGHT_CHROMI ```sh js # Linux/macOS -$ PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=192.168.1.1 PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 npm i -D playwright +PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=192.168.1.1 PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 npm i -D playwright ``` ```sh python # Linux/macOS -$ pip install playwright -$ PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=192.168.1.1 PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 python -m playwright install +pip install playwright +PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=192.168.1.1 PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 python -m playwright install ``` ```sh java # Linux/macOS -$ PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=192.168.1.1 PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 mvn test +PLAYWRIGHT_FIREFOX_DOWNLOAD_HOST=192.168.1.1 PLAYWRIGHT_DOWNLOAD_HOST=192.168.1.78 mvn test ``` ## Skip browser downloads @@ -217,31 +217,31 @@ This can be done by setting `PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD` variable before i ```sh js # Linux/macOS -$ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright +PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright # Windows -$ set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 -$ npm i -D playwright +set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 +npm i -D playwright ``` ```sh python # Linux/macOS -$ pip install playwright -$ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 python -m playwright install +pip install playwright +PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 python -m playwright install # Windows -$ set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 -$ pip install playwright -$ playwright install +set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 +pip install playwright +playwright install ``` ```sh java # Linux/macOS -$ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 mvn test +PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 mvn test # Windows -$ set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 -$ mvn test +set PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 +mvn test ``` ## Download single browser binary @@ -261,7 +261,7 @@ Using these packages is as easy as using a regular Playwright: Install a specific package ```sh -$ npm i -D playwright-webkit +npm i -D playwright-webkit ``` Require package @@ -282,8 +282,8 @@ 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 -$ pip install playwright -$ playwright install firefox +pip install playwright +playwright install firefox ``` ## Stale browser removal diff --git a/docs/src/intro-java.md b/docs/src/intro-java.md index 9465b90e51..f9acd47b7e 100644 --- a/docs/src/intro-java.md +++ b/docs/src/intro-java.md @@ -120,7 +120,7 @@ playwright.firefox().launch(new BrowserType.LaunchOptions().setHeadless(false).s Command Line Interface [CLI](./cli.md) can be used to record user interactions and generate Java code. ```sh -$ mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen wikipedia.org" +mvn exec:java -e -Dexec.mainClass=com.microsoft.playwright.CLI -Dexec.args="codegen wikipedia.org" ``` ## System requirements diff --git a/docs/src/intro-js.md b/docs/src/intro-js.md index cc43541c70..7476448cf0 100644 --- a/docs/src/intro-js.md +++ b/docs/src/intro-js.md @@ -11,7 +11,7 @@ title: "Getting Started" Use npm or Yarn to install Playwright in your Node.js project. See [system requirements](#system-requirements). ```sh -$ npm i -D playwright +npm i -D playwright ``` This single command downloads the Playwright NPM package and browser binaries for Chromium, Firefox and WebKit. To modify this behavior see [installation parameters](./installation.md). @@ -66,7 +66,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 -$ npx playwright codegen wikipedia.org +npx playwright codegen wikipedia.org ``` ## TypeScript support diff --git a/docs/src/intro-python.md b/docs/src/intro-python.md index 11fb3a9f07..405bac57a2 100644 --- a/docs/src/intro-python.md +++ b/docs/src/intro-python.md @@ -11,8 +11,8 @@ title: "Getting Started" Use pip to install Playwright in your Python project. See [system requirements](#system-requirements). ```sh -$ pip install playwright -$ playwright install +pip install playwright +playwright install ``` These commands download the Playwright package and install browser binaries for Chromium, Firefox and WebKit. To modify this behavior see [installation parameters](./installation.md). @@ -75,7 +75,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 -$ playwright codegen wikipedia.org +playwright codegen wikipedia.org ``` ## System requirements diff --git a/docs/src/release-notes.md b/docs/src/release-notes.md index 9a56d19d5e..92c4ff2e42 100644 --- a/docs/src/release-notes.md +++ b/docs/src/release-notes.md @@ -84,10 +84,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 - $ npx playwright --help + npx playwright --help ``` ```sh python - $ playwright --help + playwright --help ``` - [`method: Page.selectOption`] now waits for the options to be present. - New methods to [assert element state](./actionability#assertions) like [`method: Page.isEditable`]. diff --git a/docs/src/test-runners-python.md b/docs/src/test-runners-python.md index c29376be8f..bdc350e3f4 100644 --- a/docs/src/test-runners-python.md +++ b/docs/src/test-runners-python.md @@ -11,7 +11,7 @@ in Python. ## Usage ```sh -$ pip install pytest-playwright +pip install pytest-playwright ``` Use the `page` fixture to write a basic test. See [more examples](#examples). @@ -27,16 +27,16 @@ To run your tests, use pytest CLI. ```sh # Run tests (Chromium and headless by default) -$ pytest +pytest # Run tests in headed mode -$ pytest --headed +pytest --headed # Run tests in a different browser (chromium, firefox, webkit) -$ pytest --browser firefox +pytest --browser firefox # Run tests in multiple browsers -$ pytest --browser chromium --browser webkit +pytest --browser chromium --browser webkit ``` If you want to add the CLI arguments automatically without specifying them, you can use the [pytest.ini](https://docs.pytest.org/en/stable/reference.html#ini-options-ref) file: @@ -114,7 +114,7 @@ def test_visit_example(page): Start Pytest with the `base-url` argument. ```sh -$ pytest --base-url http://localhost:8080 +pytest --base-url http://localhost:8080 ``` ```py diff --git a/docs/src/why-playwright.md b/docs/src/why-playwright.md index aa8e9c2d9b..91eafd4525 100644 --- a/docs/src/why-playwright.md +++ b/docs/src/why-playwright.md @@ -38,11 +38,11 @@ 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 - $ npm i playwright + npm i playwright ``` ```sh python - $ pip install playwright - $ playwright install + pip install playwright + playwright install ``` * **TypeScript support**. Playwright ships with built-in types for auto-completion and other benefits. diff --git a/packages/README.md b/packages/README.md index bc7f24eced..21121518a8 100644 --- a/packages/README.md +++ b/packages/README.md @@ -26,14 +26,14 @@ As of May 20, 2020, [`//packages/build_package.js`](./build_package.js) does the To build `playwright` package and save result as `./playwright.tgz` file: ```sh -$ ./packages/build_package.js playwright ./playwright.tgz +./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 -$ ./packages/build_package.js playwright ./playwright.tgz --no-cleanup -$ ls ./packages/playwright # inspect the folder +./packages/build_package.js playwright ./playwright.tgz --no-cleanup +ls ./packages/playwright # inspect the folder ``` diff --git a/types/types.d.ts b/types/types.d.ts index a52ac6dd81..c983bfdc61 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -7737,7 +7737,7 @@ export {}; * via setting the following environment variable when installing Playwright: * * ```sh js - * $ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright + * PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright * ``` * */ @@ -9367,7 +9367,7 @@ export interface Download { * via setting the following environment variable when installing Playwright: * * ```sh js - * $ PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright + * PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm i -D playwright * ``` * */ diff --git a/utils/linux-browser-dependencies/README.md b/utils/linux-browser-dependencies/README.md index f5d2c8ff61..4987b429b7 100644 --- a/utils/linux-browser-dependencies/README.md +++ b/utils/linux-browser-dependencies/README.md @@ -13,7 +13,7 @@ and shared libraries it provides, per distribution. To generate a map of browser library to package name on Ubuntu:bionic: ```sh -$ ./run.sh ubuntu:bionic +./run.sh ubuntu:bionic ``` Results will be saved to the `RUN_RESULT`.