Free tools Windows power users keep installed
One-click scans. No signup required.
Set screenshot tolerance on Playwright Test’s toHaveScreenshot() assertion. Use threshold when you want to allow a small color difference at each matching pixel; use maxDiffPixels or maxDiffPixelRatio when you want to cap the total area that may change. These options can be set on one assertion or shared under expect.toHaveScreenshot in playwright.config.ts. Stabilize fonts, data, animations, and the rendering environment before increasing any limit.
What “tolerance” means in a Playwright screenshot test
Playwright Test takes screenshots until two consecutive captures match, then compares the final capture with the stored baseline. The first run creates that baseline; later runs produce a diff when the current image does not meet the configured limits. See the Visual comparisons guide for the complete workflow.
Screenshot assertions have three independent comparison controls:
| Option | What it permits | Documented range or default | Best fit |
|---|---|---|---|
threshold |
A perceived color-distance difference for each corresponding pixel | 0 (strict) to 1 (lax); the documented pixelmatch default is 0.2 | Small anti-aliasing, color-management, or compression variation spread across an otherwise identical image |
maxDiffPixels |
A maximum number of pixels that may differ | Unset by default | A known, small, localized change such as an icon or one-pixel border |
maxDiffPixelRatio |
A maximum fraction of all pixels that may differ | 0 to 1; unset by default | A responsive or differently sized capture where a proportion is more useful than a fixed count |
The threshold value answers “how different may each pixel’s color be?” The count and ratio answer “how many pixels may be different overall?” They are not interchangeable. Playwright documents the 0.2 value as pixelmatch’s default, not as a universal recommendation for every project. Choose the smallest allowance that represents an accepted variation in your own UI.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Set tolerance on one screenshot assertion
Pass the option directly to expect(page).toHaveScreenshot(). This TypeScript example shows the three tolerance models; use only the option or combination that expresses your policy.
import { test, expect } from '@playwright/test';
test('visual state', async ({ page }) => {
await page.goto('/');
// Allow a small per-pixel color difference.
await expect(page).toHaveScreenshot({ threshold: 0.25 });
// Or allow no more than 100 different pixels.
await expect(page).toHaveScreenshot({ maxDiffPixels: 100 });
// Or allow a proportion of the image to differ.
await expect(page).toHaveScreenshot({ maxDiffPixelRatio: 0.01 });
});
In a real test, normally keep one assertion per visual state rather than running all three examples against the same baseline. A locator assertion uses the same comparison options and is useful when the page contains unrelated, volatile regions:
test('shopping-card appearance', async ({ page }) => {
await page.goto('/catalog');
await expect(page.locator('[data-testid="product-card"]'))
.toHaveScreenshot({ maxDiffPixels: 80 });
});
Use a locator when the component is the subject of the test. A full-page assertion is appropriate for a page-level contract, but it also includes more pixels and therefore tends to expose more unrelated changes.
Choose between threshold, pixel count, and ratio
Use threshold for per-pixel color variation
A threshold can make a comparison tolerant of tiny color changes at many pixels. This can help with anti-aliased text or differences introduced by a browser’s rendering pipeline. It does not limit the number of changed pixels: a large region can still pass if every pixel remains within the color distance.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Because the documented range runs from 0 to 1, a value closer to 0 is stricter and a value closer to 1 is more permissive. Start at the strict setting that passes consistently in your controlled environment, then increase it only when the reviewed diff is an acceptable rendering variation.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Use maxDiffPixels for a fixed visual budget
maxDiffPixels is easier to reason about when a specific, bounded area may change. For example, a test might intentionally permit a small badge update while still failing if a whole panel moves. The option is an integer pixel count and is unset unless you provide it.
Use maxDiffPixelRatio for proportional changes
A ratio is useful when the screenshot dimensions vary by project or device. A value of 0.01 means one percent of the captured pixels may differ. Keep the denominator in mind: one percent of a full-page image can be a substantial area, while one percent of a small component is much smaller.
Combining limits
You can provide more than one comparison limit when you need both a color-distance rule and an area budget. If any configured limit is exceeded, the assertion fails. Combining limits is most useful when you can explain both policies—for example, permit minor color noise but never permit more than a specified number of changed pixels. Do not add options merely to make a failing test pass; inspect the diff first.
Set a shared default in playwright.config.ts
Put a policy that is appropriate for most tests under expect.toHaveScreenshot. Playwright’s configuration and TestConfig API document this scope.
import { defineConfig } from '@playwright/test';
export default defineConfig({
expect: {
toHaveScreenshot: {
maxDiffPixels: 100,
// You may choose threshold or maxDiffPixelRatio instead,
// or combine limits when that policy is intentional.
},
},
});
A per-assertion option is clearer for an exceptional component or page. Keep the global setting strict enough that a newly added test does not silently inherit a broad allowance. If you change the global policy, review the diffs produced by the entire suite because every screenshot assertion is affected.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Make screenshots deterministic before relaxing tolerance
Many “tolerance” failures are actually unstable inputs. Playwright’s visual-comparison documentation identifies the host operating system, browser version, browser settings, hardware, power source, and headless mode as possible sources of variation. Generate and review baselines in the same environment used for comparison whenever possible.
Control the rendering environment
- Pin the browser version used by CI and local baseline generation.
- Run baseline creation and verification with the same browser engine, viewport, device scale factor, fonts, and color settings.
- Use the same operating-system image for baseline and comparison jobs when pixel-level stability matters.
- Do not compare a headed local capture with a headless CI baseline without checking the resulting rendering differences.
Remove dynamic content at the source
- Seed the database and use fixed test data.
- Freeze or mock timestamps, random identifiers, rotating promotions, and user-specific content.
- Wait for the application’s loaded state instead of capturing while a layout is still changing.
- Hide a genuinely irrelevant region or give it a deterministic value rather than allowing a large diff.
Screenshot assertions disable animations and hide the caret by default. For additional volatility, use stylePath to apply a stylesheet that filters an element or changes its appearance. The option is intended to improve repeatability; it should not conceal a UI area whose appearance is part of the behavior you want to test.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
test('stable dashboard', async ({ page }) => {
await page.goto('/dashboard');
await expect(page).toHaveScreenshot({
stylePath: './tests/visual-stability.css',
maxDiffPixels: 120,
});
});
/* tests/visual-stability.css */
[data-testid="clock"],
[data-testid="live-notification"] {
visibility: hidden !important;
}
Only filter content that is intentionally outside the assertion’s contract. A passing screenshot after hiding the main navigation is not evidence that the navigation is correct.
A practical workflow for setting a value
- Create a baseline in the target environment. Run the test once so Playwright records the expected image, then commit that baseline with the test.
- Repeat the test without code changes. If identical runs fail, fix fonts, data, timing, browser versions, or dynamic regions before touching tolerance.
- Read the diff and its pixel count. Decide whether it is a color-distance issue, a small localized area, or a proportional layout difference.
- Select the matching control. Use
thresholdfor per-pixel color variation,maxDiffPixelsfor a fixed area, ormaxDiffPixelRatiofor a fraction of the image. - Set the narrowest value that passes the reviewed change. Prefer a local override when only one assertion has the exception.
- Review future diffs as changes. A passing assertion means the image stayed within the configured limits; it does not prove that every visual difference is harmless.
Common failures and precise fixes
“The test fails on CI but passes locally”
Compare the CI and local OS image, Playwright/browser version, installed fonts, viewport, device scale factor, and headless mode. Recreate the baseline in the same CI environment or make those inputs identical. Increasing tolerance should be the last step, not the first.
“The diff is a large block after a small content change”
Look for reflow caused by different text, missing fonts, an image with no fixed dimensions, or a late-loading stylesheet. Wait for the relevant selector or application-ready state and ensure assets are available. A large layout shift is generally a product change to investigate, not a reason to raise maxDiffPixels.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
“Only text edges differ by a few shades”
This is a candidate for a small threshold adjustment after confirming that the font and browser are the intended ones. If the affected area is tiny and known, a small maxDiffPixels limit may communicate the policy more clearly.
“A timestamp, cursor, or animation keeps changing”
Use fixed test data, wait for a stable state, and rely on Playwright’s default animation disabling and caret hiding. Apply stylePath only to elements that are intentionally excluded. Do not hide an element simply because it exposes a regression.
“The test passes even though a section visibly changed”
Your threshold may be too lax, or a count/ratio limit may be too high for the image size. Lower the allowance, assert the changing component with a locator, and inspect the generated diff. Check whether an overly broad style filter is masking the section.
“The baseline itself is wrong”
Delete or replace the baseline only after reviewing the change and confirming that the new rendering is intentional. Regenerate it in the same controlled environment that will run future comparisons; do not update snapshots automatically as a substitute for review.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Performance, reliability, and maintenance
Full-page images contain many more pixels than component screenshots, so they naturally produce larger diffs and more image-comparison work. Use locator screenshots for component-level contracts and reserve full-page assertions for page composition. Keep baselines in version control, review them alongside code changes, and document why a non-default tolerance exists.
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
One global allowance is convenient but can hide which page is inherently noisy. A small local exception preserves a stricter default for the rest of the suite. Conversely, if every test requires the same environment-specific allowance, centralizing it under expect.toHaveScreenshot avoids repeated configuration. Revisit tolerances when you upgrade browsers, operating systems, fonts, or rendering settings.
Or skip the browser setup
If your goal is a clean image of a URL rather than an in-test visual assertion, ScreenshotNeo provides a website screenshot API and MCP server. It accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
One request returns PNG, JPEG, WebP, or PDF. The API supports full-page captures with lazy images loaded, CSS-selector element captures, dark mode, 12 device presets plus custom viewports, retina scale, PDF paper and margin controls, custom CSS and JavaScript, clicks before capture, hidden selectors, selector/delay/network-idle waits, request and resource blocking, custom headers/cookies/user agents/Authorization, timezone and geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Common parameter names from other screenshot APIs also work.
See the ScreenshotNeo documentation for request details. The following calls use the supplied API endpoint and are runnable after replacing YOUR_API_KEY:
Recommended Free Tools
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}`);
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; the listed plans are Starter ($5/3,000), Growth ($15/15,000), Pro ($39/60,000), Scale ($99/250,000), and Business ($249/1,000,000). Yearly billing provides two months free, and every feature is included on every plan. Create a free ScreenshotNeo account to try the 1,000 monthly screenshots without a card.
Frequently Asked Questions
Can I use screenshot tolerance with a locator instead of the whole page?
Yes. Call toHaveScreenshot() on a locator to compare only that component, while passing the same threshold, maxDiffPixels, or maxDiffPixelRatio options.
What happens when a screenshot assertion has no baseline yet?
The first run creates the expected image. Subsequent runs compare against that stored baseline, so review the generated file before committing it.
Should tolerance values be identical for every browser project?
Not necessarily. If browser or operating-system rendering differs, use consistent project environments or document a narrowly scoped policy for the affected project rather than applying a broad allowance everywhere.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchWindows 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 reinstallQuick 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.

