Quick answer
Run these three commands to install Playwright with a working example test:
# 1. Install Node.js 20 LTS from https://nodejs.org
# 2. Create a project and scaffold Playwright
mkdir my-qa-project && cd my-qa-project
npm init playwright@latest
# 3. Run the example test
npx playwright testPrerequisites
- A machine running Windows 10+, macOS 12+, or Ubuntu 20.04+
- Admin / sudo rights to install software
- At least 2 GB free disk (browsers take ~1 GB)
- Internet access to download Node and Playwright browsers
1. Install Node.js 20 LTS
- 1
Download the LTS installer
Go to nodejs.org and pick the LTS download. In 2026 that's Node 20.x. Avoid the "Current" build — Playwright targets LTS.
- 2
Run the installer
Accept the defaults on Windows/macOS. On Linux, prefer
nvm:curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash && nvm install --lts. - 3
Verify
node --version # v20.x.x npm --version # 10.x.x
2. Install VS Code and the Playwright extension
- 1
Download VS Code
From code.visualstudio.com. Any recent build is fine.
- 2
Install the official Playwright extension
Open VS Code → Extensions (
Ctrl+Shift+X) → search "Playwright Test for VSCode" by Microsoft → Install. This adds the green ▶ gutter icons, the Testing sidebar and the record-a-test button.
3. Scaffold a Playwright project
Create an empty folder and run the official scaffolder:
mkdir my-qa-project && cd my-qa-project
npm init playwright@latestThe wizard asks four questions — recommended answers:
- TypeScript or JavaScript? → TypeScript
- Where to put your tests? →
tests - Add a GitHub Actions workflow? → Yes
- Install browsers? → Yes (downloads Chromium, Firefox and WebKit)
You'll end up with this structure:
my-qa-project/
├── .github/workflows/playwright.yml
├── tests/
│ └── example.spec.ts
├── tests-examples/
├── playwright.config.ts
├── package.json
└── package-lock.json4. Run the example test
npx playwright test # runs headless in all 3 browsers
npx playwright test --ui # opens the UI Mode (recommended)
npx playwright test --headed # see the browser
npx playwright show-report # last HTML reportYou should see something like:
Running 6 tests using 6 workers
6 passed (7.3s)
To open last HTML report run:
npx playwright show-reportnpx playwright test --ui gives you time-travel debugging, live locator picking and watch mode. It's the single biggest productivity boost — don't skip it.5. Troubleshooting common errors
Error: 'command not found: npx'
Node isn't on your PATH. Reopen the terminal, or on Windows re-run the installer and tick "Add to PATH".
Error: 'Playwright: browserType.launch: Executable doesn't exist'
Browsers didn't download. Run:
npx playwright install
# On Linux CI also needed:
npx playwright install --with-depsBehind a corporate proxy
# macOS / Linux
export HTTPS_PROXY=http://user:pass@proxy.company.com:8080
export HTTP_PROXY=$HTTPS_PROXY
npx playwright install
# Windows PowerShell
$env:HTTPS_PROXY="http://user:pass@proxy.company.com:8080"
npx playwright installOr point at an internal mirror: PLAYWRIGHT_DOWNLOAD_HOST=https://mirror.company.com.
Slow / hanging install on Linux
Missing OS libs. Run sudo npx playwright install-deps. On Ubuntu 24.04 you may also need sudo apt install libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2.
6. Hands-on task (5 minutes)
- 1
Open UI Mode
Run
npx playwright test --ui. Click any test to run it and use the time-travel slider. - 2
Break something on purpose
Open
tests/example.spec.tsand changeexpect(page).toHaveTitle(/Playwright/)to/BrokenTitle/. Save. Watch UI Mode re-run and show the diff. - 3
Restore and commit
Fix the assertion, then
git init && git add . && git commit -m "chore: scaffold Playwright". You now have a real Playwright project.
7. What's next
Setup done. Now write a real end-to-end test from scratch in Module 1 / Lesson 3: Your First Playwright Test.