Install Playwright on Windows & VS Code: Step-by-Step Guide (2026)

Last updated on August 2nd, 2026 at 10:09 am

Install Playwright on Windows using VS Code in under 5 minutes. This complete guide covers Node.js installation, npm commands, browser setup, and running your first automated test.

Are you looking for a quick Playwright installation on Windows? Many beginners struggle with missing browsers, incorrect Node.js versions, or VS Code configuration errors during setup. This step-by-step tutorial eliminates all guesswork.

By the end of this guide, you’ll have Playwright installed on your Windows system with VS Code, all supported browsers (Chromium, Firefox, and WebKit) configured, and your first test running successfully. You’ll also learn essential Playwright commands like npx playwright install and how to run tests in headed or headless mode.

Quick Playwright Install Commands for Windows

For Windows users (VS Code terminal):

npm init playwright@latest

To install Playwright browsers manually on Windows:

npx playwright install

To run your first test:

npx playwright test

To install Playwright Chromium only:

npx playwright install chromium

Full step-by-step instructions with screenshots are provided below.

Why Use Playwright for Test Automation?

Playwright is widely used in professional QA environments where teams rely on modern software testing tools, CI/CD testing tools, and automated testing services to ensure fast and reliable releases. It’s a lightweight automation framework that works seamlessly on Windows, macOS, and Linux.

This built-in browser support makes Playwright a strong choice among modern web application testing tools used by startups and large organizations alike.

How to Install Playwright on Windows (Step-by-Step)

Before you configure Playwright in VS Code, ensure that Node.js and Visual Studio Code are already installed on your Windows system. If not, follow the steps below to download and install both for your Playwright automation framework setup.

Step 1: Install Node.js for Playwright on Windows

Download Node.js for Windows

  • Visit the official Node.js download page.
  • Click on the “Get Node.js” button. It will take you to the Node.js download page.
Download Node.js for Playwright installation on Windows
  • Select Windows as your operating system and download the compatible Node.js version.
Select Windows to download compatible Node.js version for Playwright installation

Install Node.js on Windows

  • Run the Node.js installer, then simply follow the default setup instructions in the installation wizard.
  • Important: Ensure “Add to PATH” is selected during installation to avoid errors.

Verify Node.js Installation on Windows

To verify Node.js installation:

  • Open the command prompt or VS Code terminal on Windows
  • Run the node -v command
Verify node js installation using node -v.
  • You will now see the version of Node.js installed on your Windows system. This confirms the installation was successful.

Step 2: Install Visual Studio Code on Windows

Download VS Code for Windows

  • Go to the official Visual Studio Code download page to get the latest version for Windows.
  • Click on the Windows download button to begin.
Official Visual Studio Code download page with OS options for Windows, macOS, and Linux

Install VS Code on Windows

  • Use the Visual Studio Code setup wizard to install VS Code on your Windows system.

Launch VS Code on Windows

  • Start Visual Studio Code by clicking its icon in the Start menu (Windows) or Applications folder (macOS).

Step 3: Run Playwright Install in VS Code Terminal

Now let’s set up Visual Studio Code by adding the Playwright Test extension and installing the Playwright framework.

In enterprise projects, this setup is often integrated with QA automation services and cross-browser testing services for large-scale test execution.

Open a New Project Folder in VS Code

  • Create (manually or using mkdir Playwright Automation) and open a folder named Playwright Automation in the D: drive (or any location on Windows). This will be your project workspace for setting up Playwright test automation.
  • Click on File > Open Folder (or press Ctrl + K then Ctrl + O) and select your workspace folder in VS Code.
Opening Playwright Automation folder in Visual Studio Code for setting up Playwright project.

Install the Playwright Test for VSCode Extension

  • Search and install “Playwright Test for VSCode” extension from the Extensions view (Ctrl+Shift+X).
Searching and installing Playwright Test for VSCode extension from the Extensions view in Visual Studio Code

Install Playwright on Windows Using npm

Now you’re all set to begin the Playwright installation process on Windows.

To set up Playwright inside VS Code on Windows, just follow these easy steps and run a few quick commands in the terminal. This will complete your Playwright project setup and get your automation project ready to go.

  • To open the terminal in VS Code on Windows, go to the top menu and click View > Terminal, or simply press Ctrl + ` on your keyboard.
Go to the top menu in VS Code and click View > Terminal to open the integrated terminal.
  • This will launch the integrated terminal in VS Code, where you can run the commands needed to configure Playwright.
VS Code terminal showing Playwright commands being executed
  • In the integrated terminal of VS Code, type the following command and hit Enter to start installing the latest version of Playwright:
npm init playwright@latest
Typing the command npm init playwright@latest in the VS Code terminal to install Playwright
  • This command will begin the Playwright installation steps using the most recent version available.
  • Now, the terminal will prompt you with the question:
    • “Do you want to use TypeScript or JavaScript?”
    • Choose JavaScript and press Enter to continue with the Playwright test environment setup using JavaScript.
Selecting JavaScript in the Playwright setup prompt and pressing Enter in the VS Code terminal.
  • Next, Playwright will ask:
    • “Where to put your end-to-end tests?” with a default value of tests.
    • Keep the folder name as tests and press Enter to continue the Playwright test automation setup.
Playwright setup asking where to put end-to-end tests with default folder name set to tests in VS Code terminal
  • Next, Playwright will ask:
    • “Add a GitHub Actions workflow? (y/N)” with a default value of false.
    • You can type y to enable GitHub Actions integration or n to skip it and continue the Playwright setup process.
Playwright setup asking to add a GitHub Actions workflow with default value set to false in VS Code terminal

Playwright Supported Browsers Installation on Windows

  • Next, Playwright will prompt:
    • “Install Playwright browsers (can be done manually via ‘npx playwright install’)? (Y/n)” with the default set to true.
    • Press Y to install all Playwright-supported browsers (Chromium, WebKit, and Firefox) automatically and continue the setup process.
Pressing Y in the Playwright setup prompt to install all supported browsers automatically in VS Code terminal

That’s it!

Playwright will now install everything you need: the latest framework versionsupported browsers, and all necessary configuration files within a few seconds.

Now your Playwright project structure should look like the example shown below.

This folder structure is automatically generated during the Playwright setup and includes all necessary files for running your first test.

Folder structure of a Playwright project after installation, including tests, configuration files, and node_modules in VS Code

Step 4: Run Your First Playwright Test in VS Code

Write First Playwright Test

  • Create a new test file named playwrightdemo.spec.js inside the tests folder.
    • This file will contain your first Playwright test script and is part of the recommended Playwright project structure.
First Playwright test script that opens the Facebook login page and verifies the title using JavaScript in VS Code
  • Now, write the following Playwright test code inside your playwrightdemo.spec.js file.
    • This script will open the Facebook login page and verify the page title.
// playwrightdemo.spec.js

const { test, expect } = require('@playwright/test');

test('Visit Facebook login page and verify title', async ({ page }) => {
  // Navigate to Facebook login page
  await page.goto('https://www.facebook.com/');

  // Expect the page title to contain 'Facebook'
  await expect(page).toHaveTitle(/Facebook/);
});

Run First Playwright Test

  • Running Playwright test in headed mode:
    • To run your test in visual (headed) mode on Windows, open the VS Code terminal and enter the following command. This allows you to see the browser UI while the test runs. Generally, we use the headed mode to perform visual testing in Playwright.
npx playwright test tests/playwrightdemo.spec.js --headed
  • Running Playwright test in headless mode:
    • To run your test without opening the browser UI, enter the command below in the VS Code terminal. This runs your Playwright test in headless mode, which is faster and ideal for CI/CD pipelines on Windows.
npx playwright test tests/playwrightdemo.spec.js

The command above will run your Playwright test in all three supported browsers: Chromium, WebKit, and Firefox.

This ensures your test is cross-browser compatible and works across major browser engines.

View Test Result Report

Once the Playwright test execution is complete, you can view the HTML report using the command below. This report provides a detailed summary of your test results in a browser-friendly format.

npx playwright show-report

Basic Playwright Commands for Beginners

CommandDescription
npx playwright testRuns all tests in headless mode by default.
npx playwright test –headedRuns tests in visual (headed) mode to see browser UI during execution.
npx playwright test tests/filename.spec.jsRuns a specific test file (replace filename with your test file name).
npx playwright codegenLaunches the Playwright Inspector to auto-generate test scripts by recording user actions on a given URL.
npx playwright show-reportOpens the HTML test report in your browser after test execution.
npx playwright install-depsInstalls necessary dependencies, mostly used in Linux environments.
npx playwright openOpens the specified URL using Playwright’s browser context, useful for debugging.

Many QA teams later extend their Playwright setup using cloud based testing platforms and automated testing services to reduce infrastructure costs and improve test execution speed.

Common Playwright Installation Issues on Windows

“Node is not recognized” error:
Restart your computer after installing Node.js, or run the VS Code terminal as Administrator on Windows.

“npm not found” error:
Install Node.js again and ensure “Add to PATH” is selected during installation. You may need to restart VS Code after Node.js installation.

Playwright browsers fail to download:
Run npx playwright install separately in the VS Code terminal, or check your internet connection and firewall settings on Windows.

Permission errors on Windows:
Run VS Code as Administrator by right-clicking the VS Code icon and selecting “Run as administrator.”

Test fails to run:
Ensure you are in the correct project folder (the one containing package.json) when running Playwright commands.

What’s Next After Playwright Installation

Now that you have successfully installed Playwright on Windows using VS Code, the next step is learning how to generate test scripts with ease. You can explore how Playwright’s built-in recorder works to quickly create automated tests without writing code from scratch. Check out How to Use Playwright Recorder (Codegen) After Installation to see how Playwright helps you record interactions and generate ready-to-use test code.

After completing installation, you can continue learning using this Beginner’s Playwright Automation Tutorial After Setup with step-by-step tutorials for beginners.

You can also learn how AI Helps Generate Playwright Tests automatically.

Once Playwright is installed, many teams run tests on cloud hosting platforms built for Playwright to improve speed.

Final Words

Installing Playwright on Windows is quick and beginner-friendly, especially when using Visual Studio Code. With just a few commands, you can set up Playwright, install supported browsers, and start writing automated tests in no time. Whether you’re testing on Chromium, Firefox, or WebKit, Playwright provides a reliable and powerful framework for modern test automation on Windows. Now that your setup is complete, you’re ready to write your Playwright tests and explore all the features Playwright has to offer.

Frequently Asked Questions (FAQs)

What is Playwright used for?

Playwright is a lightweight, modern automation tool for testing web applications across multiple browsers like Chrome, Firefox, and Safari.

How do I install Playwright in Visual Studio Code on Windows?

First, install Node.js and Visual Studio Code on Windows. Then open VS Code, open your project folder in the terminal, and run npm init playwright@latest. Follow the on-screen prompts to complete the Playwright installation.

What is the Playwright install command for Windows?

npx playwright install is the command to manually install Playwright browsers on Windows after the initial setup. The full installation command is npm init playwright@latest.

How do I download Playwright for Windows?

Use the command npm init playwright@latest in VS Code terminal on Windows. This automatically downloads and installs Playwright with all required browsers (Chromium, Firefox, WebKit).

How to install Playwright in VS Code on Windows?

Open VS Code on Windows, press Ctrl + ` to open the terminal, then runnpm init playwright@latest. Follow the prompts to complete the Playwright installation.

How do I install Playwright Chromium only?

Use npx playwright install chromium to install only the Chromium browser instead of all three supported browsers.

Is Node.js required to install Playwright?

Yes, Node.js is required because Playwright is a Node-based automation library. You must install Node.js before setting up Playwright.

Do I need to install browsers separately for Playwright on Windows?

No, Playwright automatically installs Chromium, Firefox, and WebKit when you initialize it using the setup command. You can also install them manually using npx playwright install.

Can I install Playwright on a specific drive like D:\ on Windows?

Yes, you can install and run Playwright from any drive or folder on Windows as long as Node.js is properly configured in your system path.

How do I verify if Node.js is installed on Windows?

You can open Command Prompt or VS Code terminal and run node -v. If installed, it will display the Node.js version number.

Does Playwright support cross-browser testing?

Yes, Playwright supports Chromium, Firefox, and WebKit, allowing you to run the same test on different browsers easily.

How do I run my first Playwright test on Windows?

After initializing Playwright, use the VS Code terminal on Windows to run npx playwright test. It will execute sample tests created during setup. To run a specific test, use npx playwright test tests/filename.spec.js.

author avatar
Aravind QA Automation Engineer & Technical Blogger
Aravind is a QA Automation Engineer and technical blogger specializing in Playwright, Selenium, and AI in software testing. He shares practical tutorials to help QA professionals improve their automation skills.

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you human? Please solve:Captcha