From the root of a Playwright Test project, run npx playwright test. Playwright runs tests headlessly by default and prints results in the terminal. To run one file, add its path, for example npx playwright test tests/example.spec.ts. If the project or its browser binaries are not installed yet, set those up first.
Check what kind of Playwright script you have
The command depends on whether you mean a Playwright Test test file or a standalone Node.js script. The standard command npx playwright test is for projects using the Playwright Test runner, typically with a configuration file and test files. It discovers and runs configured tests; it is not a general command for executing every JavaScript file that imports Playwright.
If you have a standalone script such as capture.js that uses the Playwright library directly, run it with Node.js: node capture.js. The project must have the relevant Playwright package installed, and the browser it launches must be installed as well. The examples below focus on Playwright Test, which is what most questions about running a Playwright test in the terminal mean.
Install the project and browser prerequisites
- Open a terminal in the project directory. Start in the folder containing the relevant
package.jsonand, for a configured test project, its Playwright configuration. Running commands from a different directory can make package resolution or test discovery fail. - Install Playwright Test if the project does not already use it. Run
npm install -D @playwright/test. If the project already has dependencies installed and the package listed, use its normal package installation workflow rather than adding a second copy. - Install the browser binaries. Run
npx playwright installto install the browsers Playwright supports. If you only need Chromium, usenpx playwright install chromium. - On supported Linux CI machines, install system dependencies if needed. Run
npx playwright install --with-deps chromiumto install Chromium and its operating-system dependencies. This option is intended for supported Linux environments; it is not a universal fix for every operating system or Linux distribution.
Use the package manager already adopted by your project. The equivalent test-runner invocations include yarn playwright test and pnpm exec playwright test. Keep installation and execution consistent with the project’s lockfile and package-manager conventions.
Recommended Free Tools
#1 Best Overall
- 14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
Run all tests, one file, or a selected project
Run the following commands from the project directory. Add a path or option to narrow the run instead of editing the test suite when you only need a quick check.
| What to run | Command | Use it when |
|---|---|---|
| All configured tests | npx playwright test |
You want the normal project test run. |
| One test file | npx playwright test tests/example.spec.ts |
You are working on a specific test file. |
| One or more directories | npx playwright test tests/todo-page/ tests/landing-page/ |
You want to run tests grouped in selected folders. |
| One configured browser project | npx playwright test --project=chromium |
You want to test only the project named chromium in the configuration. |
| A test matching a title or pattern | npx playwright test -g "add a todo item" |
You want to select tests by title rather than file. |
The project name after --project must match a project configured in your Playwright configuration. A project may represent a browser, device, or other test configuration; do not assume every project is named chromium. For cross-browser coverage, run all configured projects or select the specific Chromium, Firefox, and WebKit projects the project actually defines.
Choose how much browser visibility you need
Tests are headless by default: the browser runs without an on-screen window, and results appear in the terminal. If a failure is difficult to understand, increase visibility in stages.
- Show the browser:
npx playwright test --headedruns with a visible browser window. This is useful for watching navigation and interactions, but it does not by itself open Playwright’s debugging tools. - Pause for interactive debugging:
npx playwright test --debuglaunches the test in Playwright’s debugging workflow, including the Inspector. Use it to step through actions and inspect what the test is doing. - Use the interactive runner:
npx playwright test --uiopens UI mode, which provides an interactive way to run and inspect tests.
These options answer different questions: --headed lets you see the browser, while --debug and --ui add interactive diagnosis. Choose the least elaborate mode that reveals the problem.
Free tools Windows power users keep installed
One-click scans. No signup required.
Control concurrency and inspect results
Reduce parallel work while diagnosing
Playwright runs tests in parallel by default. Parallelism is normally useful for suite execution, but it can make a failure harder to diagnose if tests depend on shared state or interfere with one another. Rerun with one worker:
Rank #2
- 1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core
- 4GB DDR4 System Memory; 128GB Solid State Drive
- 11.6" HD (1366 x 768) Multi-Touch Display
- Combo headphone/microphone jack - Noble Wedge Lock slot - HDMI; 2 USB 3.1 Gen 1
- Windows 11 Pro
npx playwright test --workers=1
If the failure disappears, investigate shared accounts, data, files, ports, or other state that tests may be changing. A single-worker run is a diagnostic aid; it does not prove that the test is reliable under parallel execution.
Open the HTML report
After a test run has produced an HTML report, open it with:
npx playwright show-report
This opens the report for reviewing test outcomes outside the terminal. If there is no report to open, check that the test run completed and that the project’s reporter configuration produces an HTML report.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Generate a starter test from a live site
To record browser interactions and generate starter code, run:
npx playwright codegen https://example.com
Replace the example URL with the page you want to explore. Code generation can help turn a manual flow into a starting point, but treat the output as code to review: confirm the selected locators, assertions, and expected behavior before relying on it as a test.
Rank #3
- 256 GB SSD of storage.
- Multitasking is easy with 16GB of RAM
- Equipped with a blazing fast Core i5 2.00 GHz processor.
Run a standalone Playwright script
If your file is a normal Node.js program rather than a Playwright Test test, invoke Node directly. For example, a minimal ES module script could look like this:
import { chromium } from '@playwright/test';
const browser = await chromium.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com');
console.log(await page.title());
} finally {
await browser.close();
}
Save it as capture.mjs and run node capture.mjs from a project where @playwright/test and its Chromium browser are installed. If the file uses CommonJS syntax instead of ES modules, use the matching import style and file/package configuration for that project. A standalone script’s output and error handling are controlled by that script; the Playwright Test runner’s test discovery, reporting, and test options do not automatically apply.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Common terminal errors and practical fixes
“Executable doesn’t exist” or a browser is missing
The Playwright package is present, but the matching browser binary may not be installed for that version. Run npx playwright install, or install only the browser your project needs with npx playwright install chromium. After upgrading Playwright, check the installed package version with npx playwright --version and refresh the browser binaries with npx playwright install.
Linux reports missing shared libraries or system dependencies
On a supported Linux CI machine, try npx playwright install --with-deps chromium. If the environment is not a supported Linux setup, the command may not address its package-manager or system-library requirements; check the environment’s compatibility and dependency setup rather than repeatedly reinstalling the test package.
No tests are found
Check that the terminal is in the project directory, the path you supplied is correct, and the file matches the project’s test naming and configuration. If you selected a project, verify that its name is configured. A path to a standalone script is not a substitute for a Playwright Test test file when invoking npx playwright test.
Rank #4
- EFFORTLESS EVERYDAY PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 Home system, delivering reliable, low-power efficiency for daily tasks like document editing, email, online classes, and web browsing
- 15.6-INCH FULL HD DISPLAY: Enjoy immersive visuals on the 15.6" FHD (1920x1080) anti-glare screen with micro-edge bezels. Delivers clear details and comfortable viewing for long study sessions, working on spreadsheets, and video playback
- RESPONSIVE MULTITASKING & STORAGE: Built with 4GB LPDDR4 RAM and 128GB eMMC storage for smooth daily essential use. Expand your storage by up to 1TB via the integrated TF card slot to easily store movies, photos, and working files
- ADVANCED CONNECTIVITY: Outfitted with 2x Full-Featured Type-C ports for data transfer, fast charging, and dual-monitor output, alongside 2x USB 3.2 Gen1 ports and a 3.5mm audio jack for complete peripheral compatibility
- LIGHTWEIGHT & SILENT OPERATION: Slim and portable for effortless travel or commuting. Features a 1MP HD webcam for remote meetings, 38Wh battery with 45W Type-C fast charging, and a fanless silent design for peaceful work environments.
The test fails only in parallel runs
Run npx playwright test --workers=1 to see whether reducing concurrency changes the result. If it does, look for order-dependent behavior or shared mutable resources; do not treat serial execution as a complete fix if the suite is expected to run in parallel.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallYou need to see what the test is doing
Use --headed to display the browser. If you need to pause, step through actions, or inspect the test interactively, use --debug or --ui. For a test that is hard to inspect after completion, open its HTML report with npx playwright show-report when the run generated one.
The command runs a different file or no tests after changing folders
Return to the project root before running the command, or provide the intended relative test path from the current directory. The package, configuration, and tests need to be resolved in the context of the project you intend to run.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Performance, reliability, and cost considerations
Local terminal execution uses the machine and browser binaries available to the project. Running all configured browsers and tests can take longer than selecting one file or project; parallel workers can shorten suite execution but may expose interference between tests. During diagnosis, narrow scope with a path, title pattern, or project and reduce workers only when concurrency obscures the issue.
The commands above do not establish a fixed runtime or a universal machine requirement: both depend on the suite, browser projects, and environment. In CI, make browser installation and Linux dependencies part of environment setup when necessary, and use a repeatable package-manager install so the project runs against its declared dependencies.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Best Value
- WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
- 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
- 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
- CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
- LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
Or skip the browser setup
Playwright is the right choice when you need to run browser tests or automate interactions in code. If your actual goal is to get a website screenshot rather than execute a test suite, ScreenshotNeo is a separate website screenshot API and MCP server for developers. It does not replace Playwright Test. Its one-request API can return an image or PDF, with optional capture settings documented at ScreenshotNeo’s API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the page verdict and billing status in headers. AI agents can use its MCP server tools, including take_screenshot, get_page_info, and capture_pdf. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Learn more at ScreenshotNeo.
Sign up for 1,000 free screenshots a month, with no card required.
Frequently Asked Questions
Does `npx playwright test` open a browser window?
No. Playwright Test runs headlessly by default; use `–headed` when you want a visible browser.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesCan I use Playwright without the test runner?
Yes. A standalone Node.js script can import Playwright and be run with `node`, provided its package and browser dependencies are installed.
Quick Recap
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.

