October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Install Playwright Test in JavaScript or TypeScript

Install Playwright Test, add its browser binaries, run the starter test, and configure a basic CI sequence for JavaScript or TypeScript projects.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To install Playwright Test in a JavaScript or TypeScript project, run npm init playwright@latest from the project directory. The setup wizard adds the test runner and can download its browser binaries; you can install browsers later with npx playwright install. On Linux or CI, use npx playwright install --with-deps when system browser dependencies are needed.

Check Playwright’s current system requirements

Playwright’s official installation documentation currently lists Node.js 22.x, 24.x, or 26.x. Supported operating systems listed there are Windows 11 or later, Windows Server 2019 or later, or WSL; macOS 14 (Sonoma) or later; and Debian 12/13 or Ubuntu 22.04/24.04/26.04 on x86-64 or arm64. These requirements can change with Playwright releases, so check the official installation page and your project’s runtime constraints before setup.

As an Amazon Associate I earn from qualifying purchases.

Use a supported Node.js version and run the setup command from the directory where you want the project files. If the project uses a different package manager, use its matching initializer command instead.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install Playwright Test in a new or existing project

For Playwright’s end-to-end test runner, the official setup command is:

npm init playwright@latest

You can run it in a new project directory or an existing JavaScript or TypeScript project. The equivalent commands for other package managers are:

  • yarn create playwright
  • pnpm create playwright

The wizard asks whether to use TypeScript or JavaScript (TypeScript is the default), where to put tests, whether to add a GitHub Actions workflow, and whether to install browser binaries. It normally uses a tests directory, or e2e when a tests directory already exists. Setup creates a configuration file, a package manifest and lockfile as applicable, a test directory, and a starter test. Running the initializer again does not overwrite existing tests. See the installation guide for the current wizard details.

Choose between Playwright Test and the browser automation library

Use Playwright Test when you want the end-to-end test runner, fixtures, assertions, test isolation, and runner tooling. Its initializer sets up the test framework as @playwright/test.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use the playwright package if you are writing custom browser automation rather than tests managed by Playwright Test. The library setup is documented separately and also requires installing browser binaries, for example:

npm install playwright
npx playwright install chromium firefox webkit

Do not confuse installing a package with installing the browsers it controls. The library documentation covers the automation-library workflow.

Install the browser binaries

The setup wizard can install browsers as part of initialization. If you skipped that prompt or need to add browsers later, run:

npx playwright install

This installs the default supported browser set. To install only Chromium, use npx playwright install chromium; you can substitute another supported browser name. Installing one browser reduces downloads when you do not need cross-browser coverage. The browser documentation explains browser versions and installation options.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Playwright releases expect particular browser binaries. After updating Playwright, rerun the install command if the required binaries are missing or have changed. On Linux, CI, or a machine without required operating-system libraries, install browsers and their system dependencies together:

npx playwright install --with-deps

You can install dependencies for one browser, such as Chromium, with npx playwright install-deps chromium. The CLI also offers options including --only-shell for installing only Chromium’s headless shell and --no-shell to omit it; use these only when your headless or CI setup calls for them. The CLI reference lists the available flags.

Run the starter test and view its results

Run the generated tests with:

npx playwright test

The default Playwright Test scaffold configures Chromium, Firefox, and WebKit projects. To run only the configured Chromium project, use:

npx playwright test --project=chromium

To see the browser while tests run, add --headed. For the interactive test runner, use --ui. After a test run, open the HTML report with:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
npx playwright show-report

These commands and the scaffold workflow are documented on the installation page.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use the right browser for the test

Playwright supports Chromium, Firefox, and WebKit. Its own browser builds are the straightforward default for broad browser coverage. You can also target branded Chrome and Edge channels when those browsers are available or installed, and use device emulation for mobile-like configurations.

Playwright’s Firefox and WebKit builds use Playwright-specific patches, so do not assume branded Firefox or Safari can be substituted directly. Platform-dependent capabilities, including media codecs, can differ. For the closest Safari-related behavior in cases such as video playback, the browser documentation recommends running WebKit on macOS. Check the browser guide when choosing channels or investigating platform differences.

Install Playwright in CI

A basic npm-based CI sequence installs the locked project dependencies, the browsers and required system packages, then runs tests:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
npm ci
npx playwright install --with-deps
npx playwright test

The setup wizard can generate a GitHub Actions workflow, and Playwright’s CI guide provides configuration examples for CI providers. It recommends one worker in CI by default for stability and reproducibility; increase parallelism only when the runner has enough capacity and your test suite benefits from it.

Troubleshoot browser installation

If browser downloads fail, first confirm that the installed Playwright package and browser binaries are compatible, then rerun npx playwright install. Downloads normally come from Microsoft’s CDN. For restricted networks or unusual environments, the browser guide documents proxy and custom download-host configuration, custom certificates through NODE_EXTRA_CA_CERTS, and connection-timeout settings.

The same guide covers browser cache locations, shared or hermetic installation paths, listing installed browsers, and removing unused browser versions. These options are useful when downloads are blocked, the browser cache is not shared with the test process, or a CI image needs controlled browser storage.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.