Playwright: Installation to Sample Test — Knowledge in 3 Minutes

Test Automation

Windows 11 allows you to install Playwright using only built-in tools such as PowerShell, without manually downloading Node.js or npm from websites.
The shortest setup process using commands is outlined below.

Windows 11 already includes Winget (Windows Package Manager), which can be used to prepare the environment.


1. Install Node.js

First, install Node.js, which is the runtime environment required to run Playwright.

Open PowerShell as Administrator and run the following command.

winget install OpenJS.NodeJS.LTS

After installation finishes, close PowerShell once and reopen it so the PATH is refreshed.

Confirm that the installation succeeded with the following command:

node -v
npm -v

If version numbers are displayed, the installation is complete.


2. Create a Playwright Project

Next, create a folder to manage your tests and initialize Playwright.

Move to the folder where you want to work, or create a new one.

mkdir my-playwright-tests
cd my-playwright-tests

Run the Playwright initialization command:

npm init playwright@latest

During the process you will be asked several questions.
You can usually proceed by pressing Enter to accept the default settings.

Typical selections:

TypeScript or JavaScript?
→ TypeScript (recommended)

Where to put your end-to-end tests?
→ tests

Add a GitHub Actions workflow?
→ false (n)

Install Playwright browsers?
→ true (y)
At this step, the browser binaries will be downloaded.


3. Run the Sample Test

After initialization finishes, a sample test will be created.
Run it to verify that everything works correctly.

npx playwright test

If you want to see the browser actually launching and running the test, run:

npx playwright test --headed