What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
The fastest reliable path is to create a Playwright Test project, install its browser binaries, add a test that uses page.goto() and a web-first expect assertion, then run it with npx playwright test. This tutorial builds that program, explains each command, shows headed, UI, filtered and browser-specific runs, and covers debugging, CI and common failures.
What you will build
Your first test will open Playwright’s public site and verify its title:
import { test, expect } from '@playwright/test';
test('homepage has the expected title', async ({ page }) => {
await page.goto('https://playwright.dev/');
await expect(page).toHaveTitle(/Playwright/);
});
test declares a test case, Playwright supplies the isolated page fixture for browser interaction, and expect checks the result. The Playwright Test API documentation describes the framework as providing a test function for declaring tests and an expect function for assertions (official API documentation).
Replace the URL and title pattern with a stable page in the application you actually own or test. A public demonstration page is useful for learning, but a passing example against it does not prove your application works.
Prerequisites and project initialization
Install a current Node.js release supported by the Playwright version you intend to use. Then open a terminal in your project directory and run:
npm init playwright@latest
The initializer creates a Playwright Test project, asks whether you prefer JavaScript or TypeScript, offers a test directory, and can add a CI workflow. It also creates a starter test and configuration. The exact prompts and generated files can change between Playwright releases; follow the initializer’s prompts for the version it installs rather than copying a prompt sequence from an older tutorial (official installation guide).
A typical project contains:
playwright.config.tsorplaywright.config.jsfor projects, retries, timeouts and reporters.- A test directory such as
tests/. - A starter specification file.
- A package manifest with
@playwright/test.
If you are adding Playwright to an existing package instead, install the test package with your package manager and use the corresponding CLI through npx.
Install the browser binaries
Playwright’s test package and its browser executables are version-linked. Install the browsers from the project directory:
Free tools Windows power users keep installed
One-click scans. No signup required.
npx playwright install
On Linux CI images you may also need operating-system dependencies. The CLI supports installing them with the browser command where your environment permits it:
npx playwright install --with-deps
Run the install again after updating Playwright if the new release requires different browser revisions. Chromium, Firefox and WebKit are covered by Playwright’s supported browser projects; a browser binary already installed for another Playwright version is not a guarantee that the current package can use it.
Create the sample test
Save this as tests/homepage.spec.ts (or use .js if you selected JavaScript):
import { test, expect } from '@playwright/test';
test('homepage has the expected title', async ({ page }) => {
await page.goto('https://playwright.dev/');
await expect(page).toHaveTitle(/Playwright/);
});
Why the assertion is written this way
page.goto() navigates the page. toHaveTitle() is a web-first asynchronous assertion: it observes browser state and retries until the condition is true or the expectation timeout expires. This is more resilient than reading a value once and comparing it immediately. Playwright documents a default assertion timeout of five seconds; it is a configuration default, not a speed guarantee. You can override it for one assertion:
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →await expect(page).toHaveTitle(/Playwright/, { timeout: 10000 });
For application behavior, prefer user-visible locators and assertions, for example:
await page.getByRole('button', { name: 'Save' }).click();
await expect(page.getByText('Saved')).toBeVisible();
Use locators that describe what a user can see or access. Avoid arbitrary sleeps as a first response to timing problems; waiting for the relevant state gives clearer failures.
Run the test
Run every configured test headlessly:
npx playwright test
The command reports passes and failures in the terminal. Playwright runs tests in parallel by default when the configuration and available workers allow it. A successful title check means this test reached the expected state in the selected project; it does not establish compatibility in every browser or environment.
See the browser
npx playwright test --headed
Headed mode opens the browser so you can watch navigation and interactions.
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 reinstallUse the interactive UI mode
npx playwright test --ui
UI mode provides an interactive view for selecting tests, stepping through actions and inspecting results. It is useful while learning and debugging, whereas a normal headless run is usually better for routine automation.
Run one file or one test title
npx playwright test tests/homepage.spec.ts
npx playwright test -g "homepage has the expected title"
The file path narrows execution to that specification. The -g filter matches test titles. Quote the expression in shells that interpret special characters.
Run one configured browser project
npx playwright test --project=webkit
The project name must exactly match a project in playwright.config.ts. The generated configuration commonly includes Chromium, Firefox and WebKit projects, but names and enabled projects can differ. Use the project list in your own configuration as the source of truth.
Rank #4
Configure projects and environments
Projects group browser, device and environment settings. Running all projects gives broader compatibility coverage; selecting one gives a faster feedback loop. A minimal configuration might look like:
import { defineConfig } from '@playwright/test';
export default defineConfig({
testDir: './tests',
use: {
baseURL: 'http://127.0.0.1:3000',
trace: 'on-first-retry'
},
projects: [
{ name: 'chromium', use: { browserName: 'chromium' } },
{ name: 'firefox', use: { browserName: 'firefox' } },
{ name: 'webkit', use: { browserName: 'webkit' } }
]
});
With baseURL, a test can navigate to / instead of repeating a host. If your application needs a server, configure the project’s web-server settings or start it before the test according to the generated configuration.
Isolation, hooks and reliable tests
Each test receives its own browser context, so cookies, local storage and pages are isolated even when tests use the same browser. Keep mutable state inside a test whenever possible. Use beforeEach for repeatable setup:
import { test, expect } from '@playwright/test';
test.beforeEach(async ({ page }) => {
await page.goto('/login');
});
test('login heading is visible', async ({ page }) => {
await expect(page.getByRole('heading', { name: 'Sign in' })).toBeVisible();
});
Do not share a mutable page between tests. Shared state creates order dependencies and makes parallel execution harder to reproduce.
Debug failures
Capture a trace on retry
Set trace: 'on-first-retry' in configuration. When a test fails and retries, the trace records actions, snapshots and network-related context for later inspection. Keep traces focused on retries or failures to avoid unnecessary artifacts during ordinary runs.
Best Value
Use headed or UI mode
Re-run the narrowest failing test with --headed or --ui. A visible run often reveals an unexpected redirect, consent dialog, animation or disabled control.
Check the locator and state
- Confirm the role, accessible name or text matches the rendered page.
- Wait for a meaningful state such as visibility, text or URL rather than adding a fixed delay.
- Verify the test data exists and is not consumed by another parallel worker.
- Check whether the test is running against the intended base URL and project.
Continuous integration
A CI job should install project packages, install Playwright browsers (and required Linux dependencies), then run npx playwright test. Playwright recommends one worker in CI when stability and reproducibility are the priority. Capable self-hosted systems can instead parallelize or shard after you have verified that the application and test data tolerate concurrency.
npm ci
npx playwright install --with-deps
npx playwright test
Pin your package lockfile, retain failure reports and ensure CI can reach the application under test. Browser binaries must be installed in the same environment where tests execute.
Common errors and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
| Executable doesn’t exist | Browser binaries are missing or belong to another Playwright version. | Run npx playwright install; after an upgrade, install again. |
| Test times out during navigation | The URL is unavailable, redirects, blocks automation or loads slowly. | Open the URL manually, verify network access and assert a stable post-load condition. Increase a targeted timeout only when justified. |
| Locator found no elements | Wrong role/name, different route, delayed rendering or a modal covering the page. | Inspect with UI or headed mode, use a user-facing locator and wait for the expected state. |
| Works locally but fails in CI | Missing OS libraries, environment variables, server startup or test data. | Install with --with-deps, verify the server and secrets, and preserve traces or reports. |
| Only one browser passes | Browser-specific layout, API or feature behavior. | Run the failing configured project directly and investigate compatibility instead of assuming one pass covers all browsers. |
Or skip the browser setup
If your goal is a clean screenshot rather than an interactive end-to-end assertion, ScreenshotNeo provides a single HTTP request. Its service accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets before capture; each step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing result.
cURL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
See the ScreenshotNeo documentation for authentication and options. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
Frequently Asked Questions
Can I use JavaScript instead of TypeScript?
Yes. Choose JavaScript during initialization and save the test with a .js extension; the test API and commands are the same.
Does one passing test prove browser compatibility?
No. Run the configured Chromium, Firefox and WebKit projects you need; a single project checks only that environment.
Should I increase the five-second assertion timeout?
Only for a demonstrably slower condition. First verify the locator, URL, application state and test data.
Recommended Free Tools
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.

