How to Install Playwright in 2026 (Windows, Mac, Ubuntu) – Step-by-Step
Complete Playwright installation guide for beginners in 2026. Set up Playwright with VS Code on Windows, Mac, Linux using npm, yarn, or Python. First test included.

This is the fastest way to learn how to install Playwright in 2026. Whether you need playwright install windows, playwright install mac, or playwright install ubuntu, this guide walks you through every step — plus the official playwright vs code setup so you can record and debug tests visually. By the end of this guide you will have Playwright running on your machine and have written your first passing test — in under 10 minutes.
You will also see how to install Playwright with Python, Java, and .NET, how to fix the most common installation errors, and how to keep Playwright updated. If you want the deeper API tour after setup, jump to our Playwright complete guide or the hands-on Playwright testing tutorial.
1. Prerequisites
Playwright is lightweight, but each language binding has a minimum runtime. Here is what your machine needs before you run any install command:
- Node.js 18+ (LTS recommended — Node 20 or 22) for the JavaScript / TypeScript version.
- Python 3.8+ for the Python binding, ideally 3.11 or 3.12.
- Java 11+ and Maven or Gradle for the Java binding.
- .NET 6+ (or .NET 8 LTS) for the C# binding.
- VS Code — strongly recommended for the official Playwright extension (record, run, and debug from the sidebar).
- 2 GB free RAM and about 1 GB disk for Chromium, Firefox, and WebKit browser downloads.
- Stable internet connection — the first install pulls ~170 MB of browsers.
Playwright 1.4x+ ships modern features like UI Mode, Trace Viewer, and the getByRole / getByTestId locator family. Everything below assumes Playwright 1.48 or newer.
2. Install Playwright on Windows
Works on Windows 10, Windows 11, and Windows Server 2022. Screenshot alt-text: Windows PowerShell running npm init playwright@latest with the interactive CLI wizard visible.
Step 1 — Install Node.js LTS
Download the Node.js LTS installer (.msi). Accept the defaults so Node is added to your PATH. Open a new PowerShell window and verify:
node -v # v22.x.x
npm -v # 10.x.xStep 2 — Create a project
mkdir playwright-demo
cd playwright-demo
npm init playwright@latestThe wizard asks:
- Language — pick TypeScript (recommended).
- Test folder — accept
tests. - GitHub Actions workflow — Yes.
- Install browsers — Yes.
Step 3 — Verify the install
npx playwright --version
npx playwright testYou should see Version 1.48.x and 3 passed. Screenshot alt-text: Windows terminal showing three Playwright example tests passing across Chromium, Firefox, and WebKit.
3. Install Playwright on Mac (Intel + Apple Silicon)
Playwright ships native ARM64 builds for Apple Silicon (M1, M2, M3, M4) — you do not need Rosetta 2 in 2026. Only enable Rosetta if you specifically want to test the x86_64 build of a browser.
Step 1 — Install Node.js with Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install node
node -v
npm -vStep 2 — Bootstrap Playwright
mkdir playwright-demo && cd playwright-demo
npm init playwright@latestStep 3 — First run
npx playwright test
npx playwright show-reportScreenshot alt-text: macOS Terminal on an Apple Silicon MacBook Pro showing Playwright installing Chromium, Firefox, and WebKit natively for arm64. If Homebrew complains about the path on M-series Macs, add eval "$(/opt/homebrew/bin/brew shellenv)" to your ~/.zshrc.
4. Install Playwright on Ubuntu / Linux
Tested on Ubuntu 22.04 LTS, Ubuntu 24.04 LTS, Debian 12, and WSL2. On Linux, browsers need system libraries like libnss3, libatk-bridge2.0-0, libx11-xcb1, libxcomposite1, libxdamage1, and libgbm1. Playwright installs them for you via --with-deps.
Step 1 — Install Node.js LTS
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
node -v && npm -vStep 2 — Install Playwright with system deps
mkdir playwright-demo && cd playwright-demo
npm init playwright@latest
npx playwright install --with-depsThe --with-deps flag runs apt-get install for every browser dependency in one shot — no manual apt install libnss3 libatk-bridge2.0-0 libxkbcommon0 libgbm1 hunting.
Step 3 — Verify
npx playwright test
npx playwright show-reportScreenshot alt-text: Ubuntu 24.04 terminal running npx playwright install --with-deps and installing Chromium plus its shared libraries.
5. Install Playwright in VS Code
The Playwright Test for VS Code extension is the single biggest productivity boost for beginners. It gives you one-click test recording, UI Mode, Trace Viewer, and inline debugging.
Step 1 — Install the extension
Open VS Code → Extensions (Ctrl+Shift+X) → search Playwright → install the Microsoft-published one. Screenshot alt-text: VS Code Extensions panel showing the official Microsoft Playwright Test extension with over 6 million installs.
Step 2 — Enable the Testing sidebar
Open the Testing icon (beaker) in the left sidebar. Your tests/ folder appears with every spec. Click the play button next to any test to run it, or the record button to generate a spec from clicks.
Step 3 — Launch UI Mode
npx playwright test --uiUI Mode is the flagship 1.4x feature: it opens a time-travel test runner with locator picking, watch mode, and step-by-step trace playback. Alt-text: Playwright UI Mode in VS Code showing timeline, DOM snapshot, console tab, and locator picker for a passing test.
6. Install Playwright with Python
Python bindings are ideal if your team already uses pytest.
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install playwright pytest-playwright
playwright install --with-depsWrite your first pytest at tests/test_google.py:
from playwright.sync_api import Page, expect
def test_search(page: Page):
page.goto("https://www.google.com")
page.get_by_role("combobox", name="Search").fill("software test pilot")
page.keyboard.press("Enter")
expect(page).to_have_title("software test pilot - Google Search")Run it: pytest --headed. The pytest-playwright plugin adds fixtures like page, browser, and context automatically.
7. Install Playwright with Java (Maven & Gradle)
Maven — add to pom.xml:
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.48.0</version>
</dependency>Gradle — add to build.gradle:
dependencies {
implementation 'com.microsoft.playwright:playwright:1.48.0'
}Download the browsers once:
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps"Sample test class:
import com.microsoft.playwright.*;
public class FirstTest {
public static void main(String[] args) {
try (Playwright pw = Playwright.create()) {
Browser browser = pw.chromium().launch();
Page page = browser.newPage();
page.navigate("https://softwaretestpilot.com");
System.out.println(page.title());
}
}
}8. Install Playwright with C# / .NET
dotnet new nunit -n PlaywrightTests
cd PlaywrightTests
dotnet add package Microsoft.Playwright.NUnit
dotnet build
pwsh bin/Debug/net8.0/playwright.ps1 install --with-depsSample NUnit test:
using Microsoft.Playwright;
using Microsoft.Playwright.NUnit;
public class HomeTests : PageTest {
[Test]
public async Task HasTitle() {
await Page.GotoAsync("https://softwaretestpilot.com");
await Expect(Page).ToHaveTitleAsync(new System.Text.RegularExpressions.Regex("SoftwareTestPilot"));
}
}Run with dotnet test. .NET 8 is the current LTS in 2026 — .NET 6 still works but is out of support.
9. Write Your First Playwright Test (JS + Python)
Five-minute example: open Google, search software test pilot, and assert the page title contains our search term. This uses the modern 1.4x locators (getByRole) that are the recommended default.
TypeScript / JavaScript
// tests/first.spec.ts
import { test, expect } from '@playwright/test';
test('Google search shows software test pilot', async ({ page }) => {
await page.goto('https://www.google.com');
await page.getByRole('combobox', { name: 'Search' })
.fill('software test pilot');
await page.keyboard.press('Enter');
await expect(page).toHaveTitle(/software test pilot/i);
});Run it: npx playwright test first.spec.ts --headed. Open the report with npx playwright show-report.
Python
# tests/test_first.py
from playwright.sync_api import Page, expect
def test_google_search(page: Page):
page.goto("https://www.google.com")
page.get_by_role("combobox", name="Search").fill("software test pilot")
page.keyboard.press("Enter")
expect(page).to_have_title("software test pilot - Google Search")Run: pytest --headed. Congratulations — that is your first end-to-end Playwright test.
10. Running Tests: Headed vs Headless, Browsers, Slow-Mo
Playwright runs headless by default because it is 2–3× faster and works in CI. Switch modes with flags:
# headed (see the real browser)
npx playwright test --headed
# only one browser
npx playwright test --project=chromium
npx playwright test --project=firefox
npx playwright test --project=webkit
# slow motion — great for debugging
npx playwright test --headed --slow-mo=500
# UI mode — the 1.4x killer feature
npx playwright test --ui
# step debugger with the Inspector
npx playwright test --debugUse UI Mode locally, headless in CI, and Trace Viewer (npx playwright show-trace trace.zip) for post-mortem debugging.
11. How to Update Playwright to the Latest Version
Playwright ships a new minor release every 4–6 weeks. Update the npm package and the browsers together:
npm install -D @playwright/test@latest
npx playwright install --with-depsFor Python: pip install -U playwright && playwright install. For Java: bump the <version> in pom.xml. For .NET: dotnet add package Microsoft.Playwright.NUnit.
Always run npx playwright install after upgrading — the browser binaries are pinned to each Playwright version.
12. Common Installation Errors & Fixes
EACCES / EPERM permission denied
# Mac / Linux
sudo chown -R $(whoami) ~/.npm
# Then reinstall
npm install -D @playwright/testNever run sudo npm install — it creates root-owned files you cannot clean up later.
Browser download failed
npx playwright install --with-deps
# Or force a fresh download
rm -rf ~/.cache/ms-playwright
npx playwright installChromium won't launch on Linux (missing libnss3)
sudo apt-get install -y libnss3 libatk-bridge2.0-0 libxkbcommon0 libgbm1 libasound2t64
# Or one-shot:
npx playwright install-depsCorporate proxy / firewall blocking downloads
# Set proxy env vars, then install
export HTTPS_PROXY=http://your.proxy:8080
export HTTP_PROXY=http://your.proxy:8080
npx playwright installYou can also point Playwright at a local mirror with PLAYWRIGHT_DOWNLOAD_HOST.
node is not recognized on Windows
Restart your terminal — the Node installer only updates PATH for new shells. If it still fails, reinstall Node.js and tick Add to PATH.
13. Uninstalling Playwright
Remove the npm package and the browser cache:
# Remove the package
npm uninstall @playwright/test
# Delete downloaded browsers
npx playwright uninstall
# or manually:
rm -rf ~/.cache/ms-playwright # Linux / Mac
rmdir /s %USERPROFILE%\AppData\Local\ms-playwright # WindowsPython: pip uninstall playwright pytest-playwright && playwright uninstall.
14. Next Steps
You are set up — now go build something real
Read the Playwright complete guide for locators, fixtures, Page Object Model, API testing, visual testing, auth, and CI/CD. Then work through the hands-on Playwright testing tutorial.
Interviewing soon? Grind Playwright interview questions and read a real Playwright interview experience for 5 years exp.
Frequently asked questions
Is Playwright free?
Yes. Playwright is fully open-source under the Apache 2.0 license and maintained by Microsoft. No paid tier, no per-seat cost, no watermark — commercial use included.
Playwright vs Selenium — should I switch?
For new projects in 2026, yes. Playwright is faster, ships auto-waiting, UI Mode, Trace Viewer, and API testing out of the box. Selenium still wins in legacy enterprise Java stacks and Grid-heavy setups. Read our full Playwright interview questions and complete guide to decide.
Can I use Playwright with Cucumber?
Yes. Use the community package cucumber-playwright or wire @cucumber/cucumber directly with Playwright's browser and page objects. Cucumber gives you Gherkin syntax; Playwright drives the browser.
Does Playwright work on CI like GitHub Actions?
Yes. When you scaffold with 'npm init playwright@latest' and answer 'Yes' to GitHub Actions, you get a ready-to-run workflow at .github/workflows/playwright.yml. It runs 'npx playwright install --with-deps' and 'npx playwright test' on every push and PR.
How to run Playwright tests in parallel?
Playwright runs tests in parallel by default across files. Control workers with 'npx playwright test --workers=4' or set 'workers: 4' in playwright.config.ts. Use 'fullyParallel: true' to also parallelize tests inside a single file.
Does Playwright support mobile emulation?
Yes — Playwright ships device descriptors for iPhone, Pixel, iPad and more. Use 'devices["iPhone 15"]' in playwright.config.ts to emulate viewport, user agent, touch and geolocation. For native iOS/Android apps use Appium instead.
Practice these questions
Drill 200+ Playwright questions with senior-SDET sample answers — locators, auto-wait, fixtures, parallelism and trace viewer.
Was this article helpful?
More from Playwright TypeScript
Playwright with TypeScript — POM, fixtures, locators.
- Automation TestingPlaywright Framework Setup with TypeScript: Complete 2026 Guide for QA Engineers
- Automation TestingPlaywright TypeScript Tutorial: Complete 2026 Guide
- Automation TestingPlaywright Locators: Complete 2026 Guide
Keep building your QA edge
Pillar guides- Selenium PillarSelenium interview questions300 Selenium WebDriver Q&A — locators, waits, frameworks.
- AI Mock InterviewSoftwareTestPilot's AI interview coachLive AI-powered mock interviews with rubric feedback.
- ATS Resume Reviewcheck your ATS score instantlyFree AI ATS scoring with rewrite suggestions.
Practice these questions live
Rehearse with an AI QA interviewer that scores your answers in real time.
Continue reading

Why Every QA Engineer Must Master CI/CD Pipelines in 2026 (Or Risk Obsolescence)
12 min read
Is Cypress Dead? Analyzing 2026 Playwright Market Share
12 min read
Why Tests Pass Locally But Fail in CI/CD (And the 6 Fixes That Actually Work in 2026)
13 min readJoin the QA Community
Connect with fellow testers, share job leads, and get career advice.
Stop Reinventing the Wheel. Upgrade Your QA Arsenal.
Take your testing skills from beginner to Lead Engineer. Supercharge your daily workflow with our premium digital resources.
- Ready-to-use testing strategy templates
- Advanced API & UI automation guides
- ⏱️ Save 10+ hours a week on test planning