What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Fix flaky Playwright screenshots by making the rendered page deterministic, waiting for application state instead of elapsed time, and comparing only pixels that belong to the visual contract. Use expect(page).toHaveScreenshot() or expect(locator).toHaveScreenshot(); Playwright waits for two consecutive identical screenshots before comparing with the baseline. Then pin the browser and rendering environment, freeze locale and time, mask or hide volatile regions, and investigate failures with a trace before changing tolerances.

What Playwright considers a stable screenshot

Screenshot assertions are synchronization tools as well as image comparisons. toHaveScreenshot() waits until two consecutive page screenshots produce the same result and compares the last one with the expectation. That built-in stability check is more reliable than taking an arbitrary screenshot after a delay.

Use a whole-page assertion when the page itself is the contract, or a locator assertion when only a component matters:

import { test, expect } from '@playwright/test';

test('dashboard visual contract', async ({ page }) => {
  await page.goto('/dashboard');
  await expect(page).toHaveScreenshot('dashboard.png');
});

test('order summary visual contract', async ({ page }) => {
  await page.goto('/checkout');
  await expect(page.locator('[data-testid="order-summary"]'))
    .toHaveScreenshot('order-summary.png');
});

Locator screenshots usually produce smaller, more diagnosable diffs and avoid unrelated page chrome. A full-page capture is appropriate when layout between sections is what you need to protect.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • 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

Repair sequence for a flaky test

  1. Reproduce in the failing environment

    Run the same CI image, browser project, viewport, fonts and test data repeatedly. Classify the diff before editing the test: moving layout, changing content, font or rasterization differences, or harmless color noise.

  2. Use a screenshot assertion

    Replace a raw page.screenshot() followed by a separate image comparison with toHaveScreenshot. The assertion retries while the rendered output is changing and reports an image diff.

  3. Turn off motion

    Playwright screenshot assertions disable CSS animations, CSS transitions and Web Animations by default. Keep that behavior unless animation itself is the feature under test. If your own screenshot helper overrides it, restore the default or provide an explicit stylesheet that freezes the animation.

  4. Wait for state, not time

    Replace waitForTimeout with a web-first assertion, a stable locator, a completed request, or an application-specific ready marker. Playwright’s guidance is direct: “Tests that wait for time are inherently flaky.”

    Free tools Windows power users keep installed

    One-click scans. No signup required.

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

    Mask dynamic regions, hide them with a screenshot stylesheet, or supply deterministic test data. Typical sources include clocks, ads, rotating recommendations, personalized names, cursors, live counters and randomly generated IDs.

  6. Pin the rendering environment

    Generate and execute baselines in the same browser, OS or container, browser version, fonts, viewport, headless mode and hardware profile. Rendering can vary with host OS, browser settings, hardware and power source. Keep each baseline tied to the Playwright project that produced it.

  7. Trace the first retry

    Enable trace: 'on-first-retry' in CI. Inspect the action timeline, DOM snapshots, screenshots, network requests and image diff. The trace often shows a late request, a layout shift or a failed font load that a failure screenshot alone cannot explain.

    Rank #2
    Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
    • 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
  8. Apply the smallest tolerance last

    Only after the preceding causes are controlled should you use maxDiffPixels, maxDiffPixelRatio or threshold. A tolerance should cover known antialiasing or color noise, not conceal unknown instability. Record why the chosen value is safe.

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

Eliminate animation and transition races

Animations can change geometry, opacity or text between two frames. The assertion’s default motion suppression handles normal CSS and Web Animations, but application code can still introduce nondeterminism through JavaScript timers or canvas drawing. Add a dedicated screenshot stylesheet for those cases:

import { test, expect } from '@playwright/test';

test('static hero', async ({ page }) => {
  await page.goto('/home');
  await expect(page).toHaveScreenshot('home.png', {
    stylePath: './visual-stable.css'
  });
});
/* visual-stable.css */
*, *::before, *::after {
  animation: none !important;
  transition: none !important;
  caret-color: transparent !important;
}

Do not freeze motion when the purpose of the test is to verify an animation frame. In that case, assert the frame explicitly and control the clock or animation progress in the application.

Mask, hide or replace dynamic content

Mask a region while preserving layout

Masking paints a solid color over a volatile area without changing surrounding geometry:

await expect(page).toHaveScreenshot('account.png', {
  mask: [
    page.locator('[data-testid="current-time"]'),
    page.locator('.ad-slot'),
    page.locator('[data-testid="user-name"]')
  ]
});

Use a stable selector and include every instance that can change. A mask is preferable when the element’s size and position are part of the contract.

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

Hide pixels with a stylesheet

Hiding is useful for a cursor, rotating card or third-party widget whose dimensions are not important:

await expect(page).toHaveScreenshot('feed.png', {
  stylePath: './hide-volatile.css'
});
[data-testid="live-clock"],
.recommendations,
.chat-widget,
.cursor {
  visibility: hidden !important;
}

Use deterministic fixtures instead when the content itself is important. Seed random values, freeze the user account and return a fixed API response. That tests the real typography and wrapping rather than replacing it with a mask.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • 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.

Wait for meaningful application readiness

A page load event does not mean that fonts, data or layout are ready. Wait for the condition the user actually sees:

await page.goto('/reports');
await expect(page.getByRole('heading', { name: 'Monthly report' }))
  .toBeVisible();
await expect(page.locator('[data-testid="report-loading"]'))
  .toBeHidden();
await expect(page.locator('[data-testid="report-chart"]'))
  .toHaveAttribute('data-ready', 'true');
await expect(page).toHaveScreenshot('monthly-report.png');

For a known request, wait for the response and then assert the rendered state:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const response = page.waitForResponse(r =>
  r.url().includes('/api/report') && r.ok()
);
await page.goto('/reports');
await response;
await expect(page.locator('[data-testid="report-chart"]'))
  .toBeVisible();

Use network-idle waits sparingly: analytics, polling and long-lived connections can prevent the condition from ever becoming true. An explicit ready marker is usually clearer.

Make locale, timezone and data deterministic

Date, number and currency formatting can change the pixels even when the DOM is identical. Set locale and timezone in the browser context and set TZ for the test runner when formatting is performed by Node.js:

// playwright.config.ts
import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: {
    locale: 'en-US',
    timezoneId: 'UTC',
    viewport: { width: 1440, height: 900 }
  },
  trace: 'on-first-retry'
});
# CI command
TZ=UTC npx playwright test

Pin seed data, account state, feature flags and API fixtures. Keep fonts installed in the image that generates the baseline; a fallback font changes line breaks, element heights and every pixel below the changed line.

Keep baselines tied to a known environment

Use Playwright projects to make browser differences explicit:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
projects: [
  { name: 'chromium-linux', use: { browserName: 'chromium' } },
  { name: 'firefox-linux', use: { browserName: 'firefox' } }
]

Generate baselines inside the same container image used in CI. Do not copy a macOS baseline into a Linux job and then compensate with a large diff threshold. If you intentionally support multiple environments, maintain a baseline set per project.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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

Choose the right comparison and tolerance

Decision Use when Risk
Whole page Page-level layout and scrolling are the contract Unrelated widgets create noise
Locator or region A component has a clear visual boundary Changes outside the region go unnoticed
Mask Geometry matters but content changes Real regressions inside the mask are hidden
Stylesheet hiding Pixels are irrelevant to the contract Unexpected overlap can be missed
Strict equality Rendering environment is pinned Antialiasing can cause legitimate noise
Narrow tolerance Known, measured color or rasterization noise Too much tolerance hides layout defects

Start with strict comparison. If a repeatable one-pixel edge difference remains in the same environment, choose the smallest documented maxDiffPixels, maxDiffPixelRatio or threshold that admits it.

CI debugging and common failure modes

The diff moves between runs

Cause: an animation, timer, asynchronous response or random fixture is still active. Fix: inspect the trace, freeze motion, replace sleeps with state assertions, and seed or mock the data.

Text wraps differently in CI

Cause: missing fonts, a different browser build, viewport or device scale factor. Fix: use the same container and browser version, install identical fonts, and pin viewport and scale settings.

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

Only dates or numbers differ

Cause: host timezone or locale. Fix: set browser locale and timezoneId, set TZ for Node.js, and use fixed test timestamps.

The screenshot contains a cookie banner, chat box or ad

Cause: third-party content is part of the capture. Fix: block the request, provide a stylesheet to hide it, or mask its locator. If the product requirement is to verify the banner itself, give that banner its own deterministic test instead of hiding it globally.

Increasing tolerance makes failures disappear

Cause: tolerance is compensating for an uncontrolled source of change. Fix: revert the broad setting, identify the changed pixels in the trace and add only a narrow, justified allowance.

Retries pass but the first attempt fails

Cause: timing-sensitive startup or a late resource. Fix: keep first-retry tracing enabled, inspect the first attempt’s network and DOM timeline, then add a state-based readiness check.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For server-side captures, ScreenshotNeo provides a website screenshot API and MCP server. It accepts a URL and returns PNG, JPEG, WebP or PDF. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets; each cleanup step can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers report the page verdict and billing result.

One request is enough (see the ScreenshotNeo documentation):

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients. Options include full-page lazy-image loading, CSS-selector element capture, dark mode, 12 device presets or any viewport, retina scale, PDF paper and page controls, custom CSS and JavaScript, clicks, selector or network-idle waits, request blocking, headers, cookies, user agent, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen-TTL caching, signed links, asynchronous webhooks, bulk capture of 100 URLs per call, a usage API and an OpenAPI specification. Parameter names used by other screenshot APIs also work.

Plan Included shots Price
Free 1,000/month $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Yearly billing gives two months free, and every feature is included on every plan. Start with 1,000 screenshots a month free—no card required.

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

FAQ

Should I use waitForTimeout before toHaveScreenshot?

No. Wait for a meaningful UI or network condition. A fixed delay can pass on one runner and fail on a slower or faster runner.

Can I use one baseline for Chromium, Firefox and WebKit?

Keep baselines tied to the browser and rendering environment that generated them. Maintain separate project baselines when those environments are intentionally supported.

When should I test an entire page instead of a locator?

Use a page assertion for page-level layout and a locator assertion when a component is the visual contract or the rest of the page contains unavoidable third-party noise.

What does a large diff threshold mean?

It permits more pixel or color variation. That is appropriate only for a measured, known rendering difference; it is not a fix for unstable content or timing.

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

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.