Next-Gen App & Browser
Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles
Learn how to install Playwright with this step-by-step guide. Covers setup, install commands, and troubleshooting tips to kickstart end-to-end testing.
Published on: September 3, 2025
Whether you're just starting with end-to-end testing or migrating from other automation testing tools, this step-by-step guide will help you install Playwright framework to get started.
Playwright is an open-source framework for fast, reliable end-to-end web testing across browsers, with support for multiple languages and advanced automation features.
How to Install Playwright Using Command Line
How to Install Playwright Using VS Code
Playwright is an open-source browser automation framework built by Microsoft. It lets you write end-to-end tests for web applications using a single API that works across Chromium, Firefox, and WebKit. You can use Playwright with JavaScript, TypeScript, Python, Java, and .NET.
It has built-in reliability features like auto-wait, trace viewer, and browser context isolation. Playwright also supports headless and headed modes, parallel execution, and full CI/CD integration. This makes it a solid choice for developers and QA engineers working in fast-paced teams.
Before installing Playwright, make sure you have a few things in place.
System Requirements:
Optional but helpful:
This method is best if you're setting up Playwright from scratch or want full control over your environment.
Step 1: Initialize a new project by running the below command:
npm init playwright@latest
Or use:
yarn create playwright
# or
pnpm create playwright
You'll be prompted to choose a language (JavaScript or TypeScript), a test folder, and whether you want to install the recommended browsers and GitHub Actions config.
Once completed, you’ll get:
Step 2: Run a sample test using the below command:
npx playwright test
This will execute the example test in headless mode. If you want to watch the browser in action:
npx playwright test --headed
Step 3: Use the interactive Test Runner to run tests, inspect traces, and debug failures using a visual interface.
npx playwright test --ui
Note: Run Playwright tests across 50+ real desktop browsers . Try LambdaTest Today!
If you like a more hands-on, user-friendly setup, Visual Studio Code makes it really easy to install and manage Playwright.
Step 1: Install "Playwright Test for VSCode" from Microsoft via the Extensions tab.
Step 2: Open an empty folder in VS Code. Then open the command palette (Ctrl+Shift+P or Cmd+Shift+P) and search for “Install Playwright.”
The extension will prompt you to:
Step 3: You can now use Playwright to run tests or debug them directly from the sidebar using the green play and debug icons. The extension also supports Trace Viewer and test output logs.
You can also check out this video tutorial on setting up Playwright by Koushik Chatterjee. He is a Founder of LetCode and Senior Software Test Automation Engineer. Koushik brings close to 10 years of experience in test automation, specializing in building reliable frameworks and driving quality at scale.
Even with a straightforward setup process, you might encounter a few common hiccups.
Here are a few of the typical installation issues and how to resolve them.
PowerShell Execution Policy Error
If you see this:
npm : File cannot be loaded because running scripts is disabled
Use the below command in PowerShell or run the command from Command Prompt instead:
powershell -ExecutionPolicy Bypass -Command "npm init playwright@latest"
Node or npm Not Recognized
Check Node.js installation using the below command:
node -v
npm -v
Ensure system PATH is correctly set. Restart your terminal if needed.
Browsers Not Installed
Install browser binaries using the below command:
npx playwright install
npx Playwright Install Not Found
Ensure Playwright is installed locally in your project. Avoid using global installations with npx.
Unable to Verify the First Certificate
This may occur in corporate environments with strict SSL/TLS policies. Set the NODE_TLS_REJECT_UNAUTHORIZED environment variable to 0 temporarily:
export NODE_TLS_REJECT_UNAUTHORIZED=0
Command Not Found
Ensure that the playwright command is available in your PATH. Reinstall Playwright if necessary.
Errors in CI Environments
On Vercel or Netlify, install only required browsers:
npx playwright install chromium
Set browser path to persist across builds if needed.
Once Playwright is installed, a few configuration steps can help you tailor it to your project’s needs.
Update Playwright
Update Playwright using the below command:
npm install -D @playwright/test@latest
npx playwright install
Modify Your Config
Edit playwright.config.ts or playwright.config.js file:
Customize Test Structure
Organize tests into folders, use tags, and set environment-specific configs with project overrides.
Installing Playwright is a straightforward process that can be accomplished via command line or Visual Studio Code. By following this guide, you can set up Playwright in your development environment and begin automating browser tasks efficiently.
By default, Playwright runs tests locally, which works well for quick feedback during development. But if you need to test across different browser versions, operating systems, or parallel sessions, integrating with a cloud-based platform like LambdaTest to streamline cross-browser execution. It is an AI testing platform that lets you run automated tests on its Playwright automation cloud across 50+ browsers and operating systems combinations.
To get started, check out this guide on Playwright testing with LambdaTest.
Did you find this page helpful?