October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober 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

Compare Website Screenshots for Visual Changes with Playwright

Use Playwright Test’s toHaveScreenshot() to create and compare visual baselines, manage dynamic content, and investigate screenshot differences in CI.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Playwright Test’s expect(page).toHaveScreenshot() assertion to compare a page or component against a committed reference image. Playwright creates the baseline on the first run, then checks later screenshots against it. The dependable workflow is to capture a deliberately prepared page in a consistent browser environment, review baseline changes, and investigate failures before updating snapshots.

Set up a visual comparison test

Install Playwright Test and its browser binaries in your project if they are not already installed. The example below assumes a Playwright Test project and a page served locally at http://localhost:3000; replace that address with the page under test.

  1. Create a test, for example tests/visual.spec.ts, and navigate to the page you want to verify.

  2. Bring the page into a known state: wait for the relevant content, set any required application data, and use a consistent viewport and browser project.

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    #1 Best Overall
    Sale
    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
  3. Call await expect(page).toHaveScreenshot('landing.png'). For example:

    import { test, expect } from '@playwright/test';
    
    test('landing page visual appearance', async ({ page }) => {
      await page.setViewportSize({ width: 1280, height: 800 });
      await page.goto('http://localhost:3000');
      await expect(page.getByRole('heading', { name: 'Welcome' })).toBeVisible();
      await expect(page).toHaveScreenshot('landing.png');
    });
  4. Run the test once in the environment you intend to use for baselines. Playwright writes the reference screenshot on the first run. Inspect it, then commit the generated snapshot directory to version control.

  5. Run the same test under the same environment in CI. A subsequent run compares the new screenshot with the committed reference and fails if the difference exceeds the configured criteria.

    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

Playwright’s visual comparison guide explains baseline creation and review: Visual comparisons.

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

Choose what to compare and how to manage noise

Full page or a focused component

A page assertion is useful for broad layout changes. For a component-level check, take a screenshot of a locator instead of the entire page. Use a locator that identifies the intended component reliably; a focused capture can reduce unrelated page changes, but it will not catch regressions outside that element. The visual comparisons guide covers both page and locator screenshot assertions.

Dynamic content and animations

Screenshot assertions disable animations by default and wait for two consecutive screenshots to match before comparing. This helps avoid capturing a page while it is still changing. For content that is expected to vary, use screenshot options such as masking, or a custom stylesheet through stylePath to hide or standardize the genuinely volatile element. Keep these controls narrow: masking a large area or suppressing too much content can hide a real visual regression. See the PageAssertions API for assertion options.

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.

Thresholds

Playwright exposes comparison controls including maxDiffPixels, maxDiffPixelRatio, and a color threshold. Start with the default behavior, inspect actual diffs, and adjust a threshold only when you understand the rendering variation it is intended to tolerate. A permissive threshold can make meaningful changes pass unnoticed. The SnapshotAssertions API documents snapshot comparison options.

Keep browser and CI environments consistent

Differences in host operating system, browser version, settings, hardware, power source, or headless mode can change rendered pixels even when application code has not changed. Pair each baseline with the same browser and platform configuration used to run it; do not casually regenerate a baseline on a developer’s different machine to fix a CI mismatch. Playwright’s visual comparisons guidance describes these sources of variation.

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

Playwright projects can target Chromium, WebKit, Firefox, and branded Chrome and Edge. Choose browser coverage based on the browsers and platforms your users need, and maintain separate baseline context for each project where rendering differs. See Playwright browsers.

Rank #4
Sale
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

In CI, install the browser binaries that match the Playwright version used by the project. If you cache browser binaries, Playwright recommends keying the cache to a hash of the Playwright version. Follow the current Continuous Integration guidance for the CI environment you use.

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

Review and update a baseline safely

When a comparison fails, treat the failure as a signal to inspect, not as an automatic reason to accept a new image. If the application change is intentional, run:

npx playwright test --update-snapshots

Review the updated screenshots and commit the accepted baseline changes with the related code change. This keeps visual changes auditable in code review.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Diagnose a failing comparison

Use Playwright Trace Viewer to inspect the expected, actual, and diff images. Check the test metadata, especially browser and viewport, before deciding whether the difference comes from the application or an environment mismatch. See Trace viewer.

Symptom Likely cause What to check
Many unrelated pixels differ The baseline and current run may use different operating systems, browser versions, rendering settings, or headless configurations. Compare Trace Viewer metadata and align the baseline and test environments.
A page capture changes between runs Content may still be loading or may be inherently dynamic. Wait for the needed state, then narrowly mask or standardize only the volatile content.
The diff shows a real layout or styling change The application appearance changed, intentionally or otherwise. Check the change in the actual image. Update snapshots only if the new appearance is intended.
CI cannot find its browser The browser binaries may be missing or not matched to the installed Playwright version. Install the matching browsers and ensure any browser cache is keyed to the Playwright version hash.

Or skip the browser setup

If you need a screenshot file rather than a Playwright visual-regression assertion, ScreenshotNeo provides a website screenshot API and MCP server. Its one-request API returns an image or PDF; for example, this cURL request saves a WebP screenshot of the page:

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 API documentation for request parameters and formats. Cookie banners, newsletter popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo’s free plan.

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 *

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.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.