What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Use Playwright Test’s toHaveScreenshot() assertion to compare a page or element against a saved image. For dependable results, create and review the baseline in a consistent browser environment, control animation and volatile content, and inspect every difference before changing the expected screenshot.
How Playwright screenshot matching works
Playwright Test supports visual assertions on either a page or a locator. On the first run, the assertion generates a reference screenshot. On later runs, it captures the current page or element and compares that image with the stored reference. Before comparison, Playwright waits until two consecutive screenshots are identical, which helps avoid comparing a page that is still changing. See Playwright’s visual comparisons guide, the PageAssertions API, and the LocatorAssertions API.
Start with a page assertion
import { test, expect } from '@playwright/test';
test('home page visual baseline', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveScreenshot('home.png');
});
Run the test using your project’s normal Playwright Test command. The first run creates the reference image rather than checking it against an existing baseline. Inspect that image and commit it with the test. Subsequent runs compare new captures with the committed image and report differences.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteLimit the assertion to a component
Use a locator assertion when the test concerns a specific component, such as a navigation bar or pricing card. A narrower capture can make failures easier to interpret and reduce unrelated page changes in the comparison.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
import { test, expect } from '@playwright/test';
test('navigation appearance', async ({ page }) => {
await page.goto('/');
const navigation = page.locator('nav[aria-label="Main"]');
await expect(navigation).toHaveScreenshot('main-navigation.png');
});
Choose a selector that identifies the intended component reliably. If the locator matches multiple elements, refine it rather than relying on an accidental match.
Make the capture repeatable
A screenshot assertion can fail even when application behavior is correct if the rendering conditions vary. Playwright’s visual-comparison guidance notes that operating system, browser version, settings, hardware, power source, and headless mode can affect rendering. Create and compare baselines in the same controlled environment; if you intentionally test different platforms or projects, maintain separate expectations where their rendering differs.
Disable animation explicitly
Screenshot assertions disable animations by default. Finite animations are fast-forwarded and infinite animations are canceled during capture, then restored. You can make the test’s intent explicit:
await expect(page).toHaveScreenshot('home.png', {
animations: 'disabled',
});
This does not replace control over other changing state, such as a rotating carousel driven by application logic or a timestamp rendered into the page.
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
Hide only irrelevant volatile content
For content that is genuinely outside the assertion’s purpose—such as a changing timestamp—use a stylesheet during capture. The stylePath option applies a stylesheet and can affect content inside shadow DOM and frames. Keep the filter narrow: hiding a component whose appearance matters can conceal a real regression.
await expect(page).toHaveScreenshot('account.png', {
stylePath: 'tests/visual-stability.css',
});
For example, the stylesheet might hide a known dynamic timestamp:
/* tests/visual-stability.css */
[data-testid="last-updated"] {
visibility: hidden !important;
}
Use a stable, purpose-specific selector. Avoid broad rules such as hiding all text or all images, because they remove meaningful evidence from the screenshot.
Free tools Windows power users keep installed
One-click scans. No signup required.
Neutralize hover state
The pointer’s location can trigger hover styles that appear in the capture. Move it to a neutral location or over an element that does not cause a relevant hover effect before taking the screenshot. For example:
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
await page.goto('/');
await page.mouse.move(0, 0);
await expect(page).toHaveScreenshot('home.png');
Choose a neutral location that is actually outside interactive content in your layout; the top-left corner is not guaranteed to be neutral on every page.
Pick page, element, and scale deliberately
- Page capture: use
page.toHaveScreenshot()when the overall page appearance is under test. - Locator capture: use
locator.toHaveScreenshot()when a particular component is the subject. - CSS scale: captures one image pixel per CSS pixel.
- Device scale: captures device pixels and can produce larger images on high-DPI displays.
Use the same scale for baseline generation and comparison. Changing scale changes the image dimensions and can make an otherwise stable page appear entirely different.
Choose a difference tolerance that fits the test
Playwright exposes three different controls; they do not mean the same thing. The TestProject configuration reference documents screenshot tolerance options and their defaults.
| Option | What it allows | Documented default |
|---|---|---|
threshold |
Per-pixel perceived color difference in YIQ space. | 0.2 |
maxDiffPixels |
An absolute number of differing pixels. | Not set |
maxDiffPixelRatio |
A proportion of pixels allowed to differ. | Not set |
Use the smallest allowance that tolerates known rendering noise while still detecting the changes the test is meant to catch. For example, a per-pixel color threshold is not a substitute for deciding how much of the whole image may change. Broadly increasing tolerances can turn a useful regression check into one that silently accepts visible changes.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
Example with an explicit allowance
await expect(page).toHaveScreenshot('home.png', {
animations: 'disabled',
threshold: 0.2,
maxDiffPixels: 20,
});
This example makes the documented default per-pixel threshold explicit and allows up to 20 differing pixels. The count is only appropriate if that amount of variation is acceptable for this particular image; it is not a recommended universal setting. Prefer a ratio when the acceptable changed area should scale with the screenshot’s size.
Review and update the baseline safely
- Generate the initial expectation. Run the visual test once in the environment you intend to use consistently.
- Inspect the created screenshot. Confirm it shows the intended state, viewport, content, and component—not an error page or an incomplete load.
- Commit the baseline. Store the generated expectation alongside the test so later runs compare against a reviewed image.
- Investigate future failures. Compare actual and expected captures, then check environment drift, fonts, browser differences, animation, pointer position, and dynamic data.
- Update only for an intentional visual change. Run
npx playwright test --update-snapshots, inspect the changed files, and include the image change in code review.
Do not use snapshot updating as an automatic response to a failure. If the difference is unintended, fix the application or stabilize the test setup. If it is intended, the updated image becomes the new contract for future runs.
Troubleshoot common visual-test failures
| Symptom | Likely cause | What to do |
|---|---|---|
| The screenshot differs on a developer machine but not in CI, or vice versa. | Rendering environment differences, such as operating system, browser version, settings, or headless mode. | Generate and compare snapshots in a consistent environment. If distinct platforms are intentionally tested, use platform-specific expectations rather than treating their output as interchangeable. |
| Only animated regions differ between runs. | An animation or changing visual state is being captured. | Keep animations: 'disabled' explicit for screenshot assertions and handle application-driven changing state separately. |
| A small region changes because of a timestamp or other live data. | Volatile content is part of the captured area. | Use stylePath to filter only content irrelevant to the assertion, or make test data deterministic when that content matters. |
| A button or link looks different despite no code change. | The pointer may be over it, triggering hover styling. | Move the pointer to a neutral location before capture and verify that the location does not trigger another relevant state. |
| A large portion of the screenshot changes after a browser or platform update. | Baseline and current capture may be using different rendering conditions or scale. | Confirm browser, operating system, capture scale, and test configuration. Update the expectation only if the new appearance is intended and reviewed. |
| The assertion passes despite a visible change that should matter. | The tolerance may be too generous, or a stylesheet may be hiding relevant content. | Reduce the applicable tolerance and audit filtering rules so the assertion covers the visual behavior it is meant to protect. |
Performance, reliability, and maintenance choices
Stable scope and predictable inputs are usually more useful than a permissive comparison. A locator screenshot keeps the test focused when only one component matters; a page screenshot is appropriate when layout and relationships across the whole page are part of the requirement. The assertion’s wait for two consecutive identical captures reduces timing noise, but it cannot make changing application data deterministic.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →- Keep baseline generation and validation on a consistent rendering setup.
- Use explicit animation handling and control pointer position.
- Make test content stable where possible; hide only irrelevant volatility.
- Keep tolerances narrow and tied to the expected noise, not to a desire to make failures disappear.
- Review image diffs as code changes, including when updating snapshots.
These choices trade convenience against regression sensitivity: filtering dynamic regions and allowing pixel differences can reduce noisy failures, but each also reduces what the test can detect. Treat every tolerance or hidden region as part of the test specification.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
Or skip the browser setup
For a standalone screenshot rather than a Playwright visual assertion, ScreenshotNeo is a website screenshot API and MCP server. It does not replace Playwright’s baseline comparison, but it can return a capture with one request. Cookie banners are accepted and removed, and known consent platforms, newsletter popups, and chat widgets are removed before the shot; each step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, with the result identified in response headers. AI agents can use its MCP server tools, including take_screenshot, get_page_info, and capture_pdf. One thousand screenshots per month are free with no card; paid plans start at $5 for 3,000.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for setup and API details. Get 1,000 free screenshots a month with no card.
FAQ
Does the first Playwright screenshot test run pass?
The initial execution creates the reference image. Inspect and commit that baseline; later executions compare captures against it.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Should I update snapshots whenever CI reports a mismatch?
No. First determine whether the difference is an unintended regression or a deliberate visual change. Update expectations only for the latter, and review the changed image.
Does a higher threshold allow more pixels to change?
No. It changes the permitted per-pixel perceived color difference. Use maxDiffPixels or maxDiffPixelRatio when setting an allowance for the number or proportion of pixels that may differ.
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.

