How to Install Playwright: Complete Step-by-Step Guide for Beginners
To install Playwright Test for JavaScript or TypeScript, run npm init playwright@latest in your project folder, complete the setup prompts and run a test. A working setup needs the Node package, compatible browser binaries and the operating-system libraries those browsers require.
This guide takes you from prerequisites to a successful test run, then explains existing-project setup, language alternatives and common installation failures. Start with the Node.js route unless your project specifically uses Python, Java or .NET.
Table of Contents
ToggleIn this guide, you will learn how to install Playwright step by step, how to install Playwright with npm, how to install browsers, how to install Playwright in VS Code, how to verify the installation, how to run your first test, how to install Playwright for Python, Java and .NET, and how to fix common installation problems.
The explanation is written in simple language, so even a beginner can follow it.
If you want to learn Playwright from installation and setup through advanced automation testing, explore our Playwright Automation Testing Course in Hyderabad.

How Do You Install Playwright?
For a new JavaScript or TypeScript project:
mkdir playwright-practice
cd playwright-practice
npm init playwright@latest
npx playwright testChoose your language and test directory, and allow the installer to download browsers. If you skipped that download, run npx playwright install before executing browser tests.
Success means a test actually passes. Printing a version only proves the command is available. If a generated test cannot reach its external website, use the self-contained setup check below to separate an installation problem from a network problem.
What Is Playwright?
Playwright is an open-source browser automation and end-to-end testing framework.
It allows you to automate modern websites and test them using Chromium, Firefox and WebKit.
In simple words, imagine that you have a website with a login page.
A person normally does this:
- Opens the browser.
- Enters the username.
- Enters the password.
- Clicks Login.
- Checks whether the dashboard appears.
Playwright can perform those actions automatically.
That means testers can create repeatable automated tests instead of manually performing the same steps again and again.
Playwright supports JavaScript, TypeScript, Python, Java and .NET. It can run tests locally and in CI environments. It also provides features such as auto-waiting, assertions, browser contexts, parallel execution, tracing and reporting.
Why Do You Need to Install Playwright?
Installing Playwright gives your project the tools required to create and run browser automation tests.
A Playwright project normally contains important files such as:
playwright.config.ts
package.json
tests/
The configuration file controls things such as browsers, test directories, retries, timeouts, projects and reporters.
The tests folder contains your automated test files.
The package information is stored in package.json.
Playwright also uses browser binaries that match the Playwright version installed in your project.
This is important because installing only an npm package is not always the complete setup.
Prerequisites Before Installing Playwright
Install a Node.js version supported by the current Playwright release. The official requirements currently list the latest 22.x, 24.x and 26.x releases. Check that page before provisioning a new machine because supported versions change.
node -v
npm -vThe current OS list includes Windows 11 or later, Windows Server 2019 or later, WSL, macOS 14 or later, and supported Debian/Ubuntu releases. Match the exact OS version and CPU architecture to the official list; a successful npm download alone does not establish browser compatibility.
If either command is missing, install Node.js, reopen the terminal and check again. Use a project folder where your account can write files. VS Code is optional; Playwright also runs from a terminal.
Step 1: Create a Folder for Your Playwright Project
Create a separate practice directory so your test dependencies and configuration stay together:
mkdir playwright-practice
cd playwright-practiceRun subsequent commands from this directory. For an existing repository, use its intended test-project folder and check the current package.json and Playwright configuration before initializing anything.
Step 2: Install Playwright
For a new Playwright project, the simplest approach is:
npm init playwright@latest
This command starts the Playwright project setup wizard.
You will be asked several questions.
For example, Playwright may ask whether you want to use JavaScript or TypeScript.
It may also ask where you want your tests stored, whether you want a GitHub Actions workflow, and whether Playwright should install browsers.
For most beginners, accepting the recommended browser installation option is a good choice.
Step 3: Choose JavaScript or TypeScript
During installation, Playwright asks you to choose a language.
You will generally see an option such as:
TypeScript
JavaScript
Should beginners choose JavaScript or TypeScript?
If you are completely new to programming, JavaScript can feel simpler at first.
If you already work with modern automation frameworks or want stronger type checking, TypeScript is an excellent choice.
For professional Playwright automation projects, TypeScript is widely used because it can catch many coding mistakes before tests are executed.
However, Playwright works with both.
The important thing is to choose one language and learn it properly.
Step 4: Choose the Test Folder
Playwright asks where you want your tests to be stored.
A common choice is:
tests
Your project may then look similar to:
playwright-demo/
│
├── tests/
│ └── example.spec.ts
│
├── playwright.config.ts
├── package.json
├── package-lock.json
└── .gitignore
The exact files can vary depending on the options you select.
Step 5: Install Playwright Browsers
Playwright needs browser binaries to execute browser automation.
The main browser engines are:
- Chromium
- Firefox
- WebKit
To install the supported browsers manually, use:
npx playwright install
You can also install one browser at a time.
For example:
npx playwright install chromium
Or:
npx playwright install firefox
Or:
npx playwright install webkit
Playwright’s browser documentation explains that each Playwright version is associated with specific browser binaries. Therefore, after upgrading Playwright, you should make sure the corresponding browser binaries are installed as well.
Do I Need Chrome Installed to Use Playwright?
No.
This is one of the most common beginner questions.
Playwright downloads and manages the browser binaries it needs for automation.
You can install Playwright’s supported browsers through the Playwright CLI.
That means you should not think of Playwright installation as simply installing an npm package.
Your automation environment needs both the Playwright package and the appropriate browser binaries.
Step 6: Check Whether Playwright Was Installed Correctly
Check three layers separately:
- Package:
npm list @playwright/testshould show a local dependency. - CLI:
npx playwright --versionshould print the installed version. - Browser execution: run a test that opens a page and passes an assertion.
If the CLI works but the browser executable is missing, run npx playwright install. On a supported Linux environment with missing system libraries, use npx playwright install --with-deps with the privileges needed to install OS packages. Check the next example before troubleshooting your application.
Step 7: Run a Self-Contained Setup Check
Save this as tests/setup-check.spec.ts, or use the test directory you selected during initialization. It does not depend on a public website or your application being available.
import { test, expect } from '@playwright/test';
test('browser installation works', async ({ page }) => {
await page.setContent('<button>Start practice</button>');
await expect(page.getByRole('button', { name: 'Start practice' }))
.toBeVisible();
});Run it with:
npx playwright test setup-check.spec.ts --project=chromiumThe default generated configuration includes a Chromium project. If your config uses another project name, substitute that name or omit the project option. A pass confirms that this project’s runner, selected browser and assertion work together. For a complete application test, continue to the Playwright tutorial.
Step 8: Open the Playwright HTML Report
Generate an HTML report explicitly and then open it:
npx playwright test --reporter=html
npx playwright show-reportThe report lists passed and failed tests, errors and configured attachments. show-report opens an existing report; it does not run the tests or create a missing report. In CI, retain the report directory as an artifact so failures remain available after the job finishes.
Step 9: Run Playwright in UI Mode
Playwright also provides UI Mode for a more visual debugging experience.
Run:
npx playwright test --ui
UI Mode can help you explore tests, inspect execution steps and debug failures more comfortably.
For beginners, this can be easier than reading only terminal output.
How to Install Playwright in VS Code
Visual Studio Code is a popular editor for Playwright development.
You can use the official Playwright VS Code extension to create and work with Playwright tests.
A simple workflow is:
- Install Visual Studio Code.
- Open your Playwright project.
- Open the Extensions panel.
- Search for the Playwright extension from Microsoft.
- Install the extension.
- Open the Command Palette.
- Use the Playwright installation command when starting a new project.
The extension can make running, debugging and working with tests easier directly inside the editor.
However, knowing the terminal commands is still important.
A professional tester should understand what is happening behind the buttons.
How to Install Playwright in an Existing Node.js Project
You do not always need to create a completely new project.
Suppose you already have a Node.js project.
You can install the Playwright Test package with:
npm install -D @playwright/test
Then install the required browsers:
npx playwright install
Now your existing project can use Playwright Test.
This approach is useful when Playwright is being added to an existing automation framework or application repository.
Playwright Package vs Playwright Test
This difference is extremely important.
Beginners often search for:
npm install playwright
and assume that it is exactly the same as:
npm install -D @playwright/test
They are related, but they serve different purposes.
playwright
The playwright package provides the browser automation library.
For example:
const { chromium } = require('playwright');
You can use it to launch a browser and automate pages directly.
@playwright/test
The @playwright/test package provides Playwright’s test framework.
It includes features such as:
- Test runner
- Assertions
- Fixtures
- Parallel execution
- Test isolation
- Reporting
- Configuration
- Retries
- Tracing support
For most people learning Playwright test automation, @playwright/test is the package they want.
How to Install Playwright for a Simple Browser Automation Script
If your goal is browser automation rather than the Playwright Test framework, you can install the library:
npm install -D playwright
Then install the browsers:
npx playwright install
A simple Node.js script can then launch Chromium.
For example:
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
console.log(await page.title());
await browser.close();
})();
This is different from a Playwright Test project.
Choose the installation method according to what you want to build.
How to Install Playwright for Python
Playwright is also available for Python.
First install the package:
pip install playwright
Then install the browsers:
python -m playwright install
If your system uses pip3, you may use:
pip3 install playwright
Then:
python -m playwright install
Python developers should also consider using a virtual environment so project dependencies remain isolated.
For example:
python -m venv .venv
Activate the environment and then install Playwright inside it.
The exact activation command depends on whether you are using Windows, macOS or Linux.
How to Install Playwright for Java
Install a Java Development Kit (JDK 8 or newer) and Maven, then check your terminal:
java -version
mvn -versionCreate a project folder and save this Maven configuration in pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>playwright-java-demo</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.microsoft.playwright</groupId>
<artifactId>playwright</artifactId>
<version>1.63.0</version>
</dependency>
</dependencies>
</project>Save this Java class as src/main/java/org/example/App.java:
package org.example;
import com.microsoft.playwright.*;
public class App {
public static void main(String[] args) {
try (Playwright playwright = Playwright.create()) {
Browser browser = playwright.chromium().launch();
Page page = browser.newPage();
page.navigate("https://example.com");
System.out.println("Page title: " + page.title());
browser.close();
}
}
}From the project directory, compile and run:
mvn compile exec:java -Dexec.mainClass="org.example.App"The first run installs the required browser binaries. Ensure your Maven compiler settings match your installed JDK. Follow the official Playwright Java installation guide for supported environments, and continue with Playwright with Java.
How to Install Playwright for .NET
Playwright also supports .NET.
A .NET project can add the Playwright package through the .NET package-management workflow.
For example, after creating your project, the Playwright package can be added using the .NET CLI.
The exact command depends on the type of .NET test project you are building.
If you are learning Playwright specifically for JavaScript or TypeScript automation, you normally do not need the .NET setup.
How to Install Only One Playwright Browser
You do not always need all supported browsers.
For example, if you only need Chromium:
npx playwright install chromium
For Firefox:
npx playwright install firefox
For WebKit:
npx playwright install webkit
Installing only what you need can be useful when disk space, CI time or download size matters.
How to Install Playwright Browser Dependencies on Linux
Linux CI machines sometimes need additional operating-system packages for browsers.
Playwright provides a command for installing browser dependencies:
npx playwright install-deps
You can also combine browser installation and dependencies:
npx playwright install --with-deps
For example:
npx playwright install --with-deps chromium
This is particularly useful for Linux-based CI environments.
Do not blindly use sudo everywhere. First understand whether your current user and environment require elevated permissions.
How to Update Playwright
Update the package and its matching browser binaries together:
npm install -D @playwright/test@latest
npx playwright installReview the release notes and rerun your suite before adopting the update. Commit the changed package manifest and lockfile. In CI, install with npm ci and use the corresponding Playwright browser installation or a matching Playwright container image. A cached browser from an older package version may not satisfy the new executable path.
Common Playwright Installation Errors and Solutions
1. node is not recognized
If you see an error saying that Node.js is not recognized, Node.js is probably missing from your PATH or has not been installed.
Check:
node -v
If it fails, install or repair your Node.js installation and restart the terminal.
2. npm is not recognized
Run:
npm -v
If this fails, check your Node.js installation and PATH configuration.
On Windows, restarting your terminal or VS Code after installing Node.js can help the terminal recognize the new PATH.
3. Browser executable is missing
You may see an error indicating that a browser executable cannot be found.
Try:
npx playwright install
Then run the test again.
4. Browser download fails
A restricted network, proxy, firewall or unstable internet connection can interrupt browser downloads.
Check your network configuration and corporate proxy settings.
If you are working inside a company network, ask your IT team whether external package and browser downloads are restricted.
5. Permission error
Permission problems can happen when Playwright or browser files are being written to a location your user cannot modify.
First check the project directory and npm configuration.
Avoid solving every permission problem by running commands as an administrator.
It is better to identify which directory actually requires permission.
6. Playwright version and browser mismatch
If you update Playwright but the required browsers are not updated, your environment can become inconsistent.
Run:
npm install -D @playwright/test@latest
Then:
npx playwright install
This gives the project the browser versions expected by the installed Playwright release.
How to Check All Playwright CLI Commands
If you forget a Playwright command, do not search the internet for every small question.
Run:
npx playwright --help
This shows available CLI commands and options.
For example, Playwright provides commands for testing, browser installation, code generation, reporting and other workflows.
Learning the CLI will make you faster as an automation tester.
What Should You Do After Installing Playwright?
Once the generated test runs and its report opens, your installation check is complete. Continue with the Playwright first-test tutorial to write a locator, action and assertion yourself.
For the wider sequence of skills and progress checks, use the learning roadmap. Return to this installation guide when you need to add browsers, update packages or troubleshoot the environment.
Playwright Installation: The Most Important Commands
Keep this small cheat sheet.
Create a new Playwright project
npm init playwright@latest
Install Playwright Test in an existing project
npm install -D @playwright/test
Install Playwright library
npm install -D playwright
Install browsers
npx playwright install
Install Chromium only
npx playwright install chromium
Install browser dependencies
npx playwright install-deps
Install browsers and dependencies
npx playwright install --with-deps
Check Playwright version
npx playwright --version
Run tests
npx playwright test
Open HTML report
npx playwright show-report
Run UI Mode
npx playwright test --ui
Final Thoughts
Learning how to install Playwright is the first step toward building modern browser automation tests.
For most beginners using JavaScript or TypeScript, remember this command:
npm init playwright@latest
Then verify the installation:
npx playwright --version
Install browsers when needed:
npx playwright install
And run your tests:
npx playwright test
But do not stop after installation.
A strong Playwright tester needs to understand locators, assertions, auto-waiting, fixtures, configuration, authentication, Page Object Model, API testing, parallel testing, debugging and CI/CD.
If you are learning Playwright for a testing career, follow these concepts step by step instead of trying to learn everything at once.
Start with installation. Build one small test. Understand why it works. Then gradually build a complete automation framework.
That is how Playwright becomes more than a tool you installed—it becomes a skill you can use professionally.
Frequently Asked Questions About Installing Playwright
Is Playwright free to install?
Yes. Playwright is an open-source browser automation and testing framework.
You can install its packages and use Playwright locally without buying a commercial Playwright license.
What is the easiest way to install Playwright?
For a new JavaScript or TypeScript testing project, the easiest approach is:
npm init playwright@latest
The command starts the project setup process and can configure the required components for you.
Can I install Playwright without Node.js?
If you are using Playwright through JavaScript or TypeScript, you need the appropriate Node.js environment.
Playwright also supports other languages, including Python, Java and .NET, which use their respective ecosystems.
Does Playwright automatically install browsers?
During the normal project setup, Playwright can install the required browsers.
You can also explicitly install them with:
npx playwright install
Do I need ChromeDriver for Playwright?
No.
Playwright manages its supported browser binaries through its own browser installation process. You do not set up ChromeDriver in the same way you would for a traditional Selenium WebDriver workflow.
Should I install playwright or @playwright/test?
If you are building a Playwright end-to-end test suite, @playwright/test is generally the package you want.
If you need the lower-level Playwright browser automation library for a custom Node.js script, playwright may be more appropriate.
Can I install Playwright in an existing project?
Yes.
For a Node.js project, you can add Playwright Test with:
npm install -D @playwright/test
Then install the browsers:
npx playwright install
Can I install only Chromium?
Yes.
Use:
npx playwright install chromium
You can similarly install Firefox or WebKit individually.
How do I know whether Playwright is installed?
Run:
npx playwright --version
If Playwright is available in the project, the command should display its version.
Why is Playwright browser installation failing?
Common causes include network restrictions, proxy configuration, firewall rules, permissions and incomplete browser downloads.
Start by checking your network and then try:
npx playwright install
For Linux environments where operating-system dependencies are missing, try:
npx playwright install --with-deps
How do I update Playwright?
Run:
npm install -D @playwright/test@latest
Then install the matching browser binaries:
npx playwright install
Check the version with:
npx playwright --version
Can I use Playwright with Python?
Yes.
Install the Python package:
pip install playwright
Then install the browsers:
python -m playwright install
Can I use Playwright with Java?
Yes.
Playwright provides Java bindings and can be managed through Maven or Gradle.
Can I use Playwright with .NET?
Yes.
Playwright provides .NET support and can be added to a .NET project through its package-management tools.

Playwright Masters Team
Playwright Automation Testing Experts | Industry-Focused Training & Practical Learning
Playwright Masters is a dedicated automation testing training platform focused on helping learners build practical skills in Playwright automation testing. Our training covers real-world automation concepts, framework practices, coding, debugging, API testing, cross-browser testing, CI/CD, and interview preparation to help learners develop job-ready testing skills.
