Complete Installation Guide
Step-by-step instructions to get Playwright running on your system
Choose Your Platform
Windows
Windows 10, 11, Server 2019+
macOS
macOS 12 Monterey and later
Linux
Ubuntu 18.04+, CentOS 7+
Step 1: Install Node.js
Note: Playwright requires Node.js version 16 or higher for JavaScript/TypeScript projects.
Official Installer
- Visit nodejs.org
- Download the LTS version for your operating system
- Run the installer and follow the setup wizard
-
Verify installation with
node --version
Package Managers
Windows (Chocolatey):
choco install nodejs
macOS (Homebrew):
brew install node
Ubuntu/Debian:
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
Step 2: Install Playwright
JavaScript/TypeScript Installation
1 Create a new project
mkdir my-playwright-project
cd my-playwright-project
npm init -y
2 Install Playwright
# Install Playwright Test
npm init playwright@latest
# Or install manually
npm install --save-dev @playwright/test
npx playwright install
3 Verify installation
npx playwright --version
npx playwright test --help
Python Installation
Requirement: Python 3.8 or higher is required.
1 Install Playwright
# Install using pip
pip install playwright
# Install using pytest plugin
pip install pytest-playwright
2 Install browsers
# Install all browsers
playwright install
# Install specific browser
playwright install chromium
3 Verify installation
python -c "from playwright.sync_api import sync_playwright; print('Playwright installed successfully')"
C#/.NET Installation
Requirement: .NET 6.0 or higher is required.
1 Create new project
dotnet new nunit -n PlaywrightTests
cd PlaywrightTests
2 Install Playwright package
dotnet add package Microsoft.Playwright.NUnit
3 Install browsers
pwsh bin/Debug/net6.0/playwright.ps1 install
Java Installation
Requirement: Java 8 or higher is required.
1 Add Maven dependency
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.40.0</version>
</dependency>
2 Install browsers
mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install"
Troubleshooting Common Issues
Solution: Use sudo for system-wide installation or install in user directory:
# Install in user directory
npm install --prefix ~/.local @playwright/test
# Or use sudo (not recommended)
sudo npm install -g @playwright/test
Solution: Check network connectivity and try manual browser installation:
# Set proxy if needed
export HTTPS_PROXY=http://your-proxy:port
# Install specific browser
npx playwright install chromium --verbose
Solution: Increase Node.js memory limit or optimize test execution:
# Increase memory limit
export NODE_OPTIONS="--max-old-space-size=4096"
# Run tests with fewer workers
npx playwright test --workers=1