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

If Playwright screenshots fail because a web font loads too late, wait for the page’s used fonts before the assertion. If a specific face or set of glyphs is required, explicitly load it and let the test fail if that load fails. Then verify that the intended font—not a fallback—is rendering, and compare screenshots in consistent browser and operating-system environments.

Wait for fonts before taking the screenshot

After navigation, await the document’s font readiness promise before running the visual assertion:

await page.goto('/page-under-test');
await page.evaluate(() => document.fonts.ready);
await expect(page).toHaveScreenshot();

document.fonts.ready fulfills when loading and layout operations for the document’s fonts in use are complete. It does not guarantee that every font declared in CSS has loaded: faces the page does not use may remain unloaded. See MDN’s documentation for Document.fonts.

Wait after the content that matters has appeared. If a click, route change, or other UI action introduces text that uses another face, wait again after that action:

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
await page.goto('/page-under-test');
await page.getByRole('button', { name: 'Show receipt' }).click();
await page.evaluate(() => document.fonts.ready);
await expect(page).toHaveScreenshot();

Use the actual control and accessible name from your page. The important order is: make the screenshot content visible, wait for its fonts, then capture.

Explicitly load a required font when readiness is not enough

If the screenshot depends on a particular face or glyph set, request it directly with document.fonts.load(). Pass a CSS font shorthand and representative text that appears in the capture:

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
await page.goto('/checkout');
await page.evaluate(async () => {
  await document.fonts.load('16px "Brand Sans"', 'Checkout total');
});
await page.evaluate(() => document.fonts.ready);
await expect(page).toHaveScreenshot();

FontFaceSet.load() forces matching faces to load and returns a promise that rejects if a font fails. The representative text helps select faces covering the characters you intend to render. See MDN’s FontFaceSet.load() reference. If the test’s text includes different scripts, symbols, or weights, use representative text and a CSS shorthand that match those screenshot requirements.

Explicit loading is especially useful when ordinary visible text does not trigger the face needed by the screenshot, or when a missing required font should be a clear test failure rather than a subtle visual difference.

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

Diagnose whether the font is late, missing, or simply different

Use the actual, expected, and diff images to classify the failure before changing assertion tolerances. Playwright’s Trace Viewer can help review screenshot comparisons and the captured page state.

  1. Check for a timing race. Add document.fonts.ready after navigation and after actions that reveal new text, then rerun the test.
  2. Check a required face directly. Call document.fonts.load() with the intended shorthand and representative screenshot text. A rejected promise indicates that the requested font load failed.
  3. Investigate delivery and declarations if loading fails. Inspect the font URL and its response, the relevant @font-face family, weight, and style declarations, and browser console or network errors. This is a practical next step when an explicit font load rejects; the exact cause depends on the application.
  4. Verify the intended face is available. A fallback can render successfully and still make the image differ. Do not treat document.fonts.check() by itself as proof that a named custom family exists or loaded. MDN explains that it can return true when that family is absent from the font set because no unloaded face from that set is needed to render. See the MDN content source for FontFaceSet.check().
  5. Compare the rendering environments. Keep browser version, operating system, browser settings, hardware, power source, and headless mode consistent where practical. Playwright identifies these as potential sources of rendering variation; separate baselines may be appropriate for intentionally different browser or platform projects. See Playwright’s visual comparison guidance.
  6. Adjust pixel tolerance only after those checks. A threshold can permit small rendering differences, but it does not make a missing or late font load correctly.

Why screenshot stabilization alone may not fix a font race

Playwright’s toHaveScreenshot() assertion retries until consecutive screenshots match, then compares the result with the baseline. Its documentation describes visual stabilization, not a guarantee that web fonts are ready. When a font timing race is suspected, add the font-specific wait before the assertion. See Playwright’s PageAssertions reference.

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

A generic networkidle wait is not a better substitute: Playwright discourages using it as a testing readiness criterion and recommends web assertions. A font-specific promise directly addresses font readiness, while an arbitrary fixed delay merely waits for a guessed duration. See the Playwright Page API.

Troubleshoot common font screenshot failures

Symptom Likely issue What to do
Screenshot text has different widths or wraps differently from the baseline. The intended face may not be ready, or a fallback may be rendering. Wait for document.fonts.ready after the relevant content appears. If the face is required, explicitly call document.fonts.load() and inspect its result.
The explicit font-load promise rejects. The matching face could not be loaded. Inspect the font URL response, @font-face family/weight/style declarations, and browser console or network errors.
document.fonts.check() returns true, but the screenshot still uses a fallback. The check is not proof that the named family exists or was loaded. Use an explicit load for the required face and representative text; verify delivery and declarations.
The screenshot still differs after fonts are ready. The difference may come from browser, OS, settings, or other rendering variation rather than font timing. Compare baseline and test environments, then use baselines suited to intentionally different projects.
Increasing the screenshot threshold makes the test pass, but text still looks wrong. The assertion tolerance is masking a real font or environment problem. Confirm the intended font and comparable rendering environment before tuning thresholds.
A fixed timeout or networkidle wait is unreliable. Neither establishes that the particular font needed by the screenshot is ready. Use document.fonts.ready or, for a specific required face, document.fonts.load().
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 a one-call screenshot rather than a Playwright test, ScreenshotNeo accepts a URL and returns an image or PDF. Its capture flow accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides screenshot tools for Claude, Cursor, and other MCP clients.

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.

Example cURL call (replace the URL with your target and set your API key):

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

See the ScreenshotNeo API documentation for request options. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for free and get 1,000 screenshots a month with no card.

Frequently Asked Questions

Does `document.fonts.ready` load every font declared in the stylesheet?

No. It waits for loading and layout operations for fonts used by the document; unused declared faces may remain unloaded.

Does `toHaveScreenshot()` guarantee that web fonts have loaded?

Its documentation describes waiting for consecutive screenshots to stabilize, not a font-readiness guarantee. Add a font-specific wait when font timing is at issue.

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

Should I use `networkidle` or a fixed timeout to wait for fonts?

Neither is a font-specific readiness signal. Use `document.fonts.ready`, or explicitly load a required face with `document.fonts.load()`.

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.