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

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

If a Playwright screenshot shows a blank shell, skeleton, or missing data, navigation probably finished before the application did. Wait for a meaningful rendered condition—usually a visible locator or a page predicate—then capture. Use the correct frame for iframe content, run addInitScript only for setup that must precede site scripts, and disable animations when deterministic pixels matter.

Why a successful navigation can still produce a blank screenshot

page.goto() reports a navigation milestone, not that React, Vue, Angular, or another client-rendered application has hydrated and populated its data. The browser may have received HTML containing only a root element while JavaScript is still downloading, executing, authenticating, or waiting for an API response. A capture taken at that point faithfully records an empty shell.

Treat capture as two separate events:

  • Navigation readiness: the document reached a selected navigation state such as commit, domcontentloaded, or load.
  • Application readiness: the UI state you intend to preserve is visible and stable.

The second event should control the screenshot. A fixed sleep can work by accident on a fast machine and fail under network or server variation.

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

The reliable capture sequence

Start with a normal navigation timeout, then wait on a condition tied to the rendered interface:

#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
const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const context = await browser.newContext();
  const page = await context.newPage();

  await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });

  // Prefer a meaningful, user-visible readiness signal.
  await page.getByRole('main').waitFor({ state: 'visible' });

  await page.screenshot({ path: 'capture.png', fullPage: true });
  await browser.close();
})();

Replace main with a heading, table, chart, result list, or application-specific marker that proves the desired view is ready. Locator waits are retried while the DOM changes, so they accommodate re-renders better than a one-time query followed by a sleep.

Choose the right readiness signal

Wait for a visible semantic element

For a dashboard, wait for the heading a user sees:

await page.getByRole('heading', { name: 'Dashboard' })
  .waitFor({ state: 'visible' });
await page.screenshot({ path: 'dashboard.png' });

This is usually the clearest failure signal: if the heading never appears, the timeout points to a missing route, authentication state, script error, or backend response.

Wait for data, not merely its container

A results container can become visible while it is still empty. Combine a locator wait with a predicate that checks the rendered content:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.locator('[data-testid="results"]')
  .waitFor({ state: 'visible' });

await page.waitForFunction(() => {
  const results = document.querySelector('[data-testid="results"]');
  return !!results && results.querySelectorAll('li').length > 0;
});

await page.screenshot({ path: 'results.png', fullPage: true });

page.waitForFunction resolves when its predicate returns a truthy value. Use it for conditions such as a data-ready="true" attribute, a non-empty chart series, or a known application store value that is reflected in the page.

Use an application marker when one exists

await page.waitForFunction(() =>
  document.querySelector('[data-ready="true"]') !== null
);

Ask the application team to expose a stable marker when possible. It is less fragile than relying on a CSS class that may change during a redesign.

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

Should you use networkidle?

Playwright defines networkidle as no network connections for at least 500 ms, and its documentation labels that state discouraged for testing. Modern applications often keep analytics, polling, WebSockets, or lazy requests open; conversely, a quiet network does not prove that the component you need has rendered. Use domcontentloaded or another navigation state to begin, then wait for a semantic locator or predicate.

If your site has a genuinely stable, finite request phase, network-idle can be a diagnostic experiment, but it should not replace an assertion about the UI you are capturing.

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

When the content is inside an iframe

A locator on the top-level page cannot see elements owned by a child frame. Create a frame locator and wait inside it:

const report = page.frameLocator('#report-frame');
await report.getByRole('heading', { name: 'Report' })
  .waitFor({ state: 'visible' });
await page.screenshot({ path: 'report.png', fullPage: true });

For more control, inspect page.frames() and select the frame by URL or name, then use that frame’s load-state and locator APIs. A cross-origin frame can still be captured by the browser, but its DOM must be addressed through the frame context rather than the parent page.

Run setup before the site’s JavaScript

Use browserContext.addInitScript when a value must exist before application scripts execute—for example, a feature flag or a capture-mode preference:

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.
await context.addInitScript(() => {
  window.localStorage.setItem('captureMode', 'true');
});

await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });

Playwright runs this script after document creation but before the page’s own scripts. It also applies it when pages navigate and when child frames attach or navigate. Do not use it as a general substitute for waiting; it changes setup, not the time required for rendering.

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

Make the actual screenshot deterministic

Capture a locator when only one component matters

await page.getByRole('main').screenshot({
  path: 'main.png',
  animations: 'disabled'
});

Locator screenshots perform actionability checks and scroll the element into view. They are useful when a full-page image would include unrelated navigation or ads.

Handle overlays, detachment, and animation

  • A cookie dialog, chat widget, or modal can cover the element you expect to see. Dismiss it or hide it before capture.
  • A component that is detached and replaced during a re-render can make a screenshot fail. Wait for the replacement locator rather than retaining an old element handle.
  • Animations can produce different frames on every run. Use animations: 'disabled' for locator screenshots and, where appropriate, inject CSS that freezes transitions.
  • Full-page capture can trigger lazy loading as the page is scrolled. Wait for the content that matters and verify that images are loaded before treating the output as final.

A debugging workflow that finds the real cause

  1. Verify the destination. Log the final URL and response status after goto. Redirects to login or an error page are common causes of an apparently blank capture.
  2. Take two images. Capture immediately after navigation and again after the readiness condition. If the second is correct, the defect is timing rather than viewport or styling.
  3. Record browser errors. Add listeners for console messages and uncaught page errors:
page.on('console', message => console.log('[console]', message.type(), message.text()));
page.on('pageerror', error => console.error('[pageerror]', error));
  1. Inspect failed requests. Log request failures and examine API responses. A page cannot render data that its backend rejected, timed out, or returned in an unexpected shape.
  2. Confirm the frame. If the visible UI belongs to an iframe, move the wait into that frame.
  3. Replace sleeps. Convert waitForTimeout into a locator or predicate tied to the desired state.
  4. Investigate a condition that never turns true. Check credentials, content-security policy, blocked resources, bot challenges, cross-origin rules, and application exceptions. These are site-specific; increasing the timeout alone may only hide the problem.

Common symptoms and targeted fixes

Symptom Likely cause Fix
Blank root element or skeleton Hydration or client rendering is incomplete Wait for a visible heading, main region, or ready marker.
Layout appears but rows are missing API data has not arrived or the response failed Wait for a non-empty result condition and inspect failed requests.
Top-level wait times out, frame looks fine in a browser Target is inside an iframe Use frameLocator or the matching Frame object.
Screenshot differs between runs Animation, lazy loading, overlays, or changing data Disable animations, wait for stable content, and remove or dismiss overlays.
Scripts never run Runtime error, blocked resource, CSP, authentication, or bot check Read console/page errors, verify responses, and reproduce with the same context settings.

Timeouts, performance, and reliability

Set a timeout long enough for the slowest legitimate API response, but keep the readiness condition specific so failures occur for an understandable reason. A broad fixed delay increases every successful run’s latency; a locator returns as soon as the UI is ready. Waiting for one stable marker is also cheaper than repeatedly taking diagnostic screenshots or polling the DOM in application code.

For repeatable jobs, use a fresh context with explicit viewport, locale, timezone, credentials, and user-agent settings. Record the URL, readiness condition, elapsed time, and failure type. A timeout should be actionable: it should tell you which selector or predicate never became true. If the page legitimately streams data forever, define the business boundary you need—such as the first 25 rows or a “loaded” badge—instead of waiting for all network activity to stop.

Or skip the browser setup

ScreenshotNeo provides a website screenshot API and MCP server when you need a rendered capture without maintaining Playwright launch, wait, and cleanup code. Its request accepts a URL and returns PNG, JPEG, WebP, or PDF; use the API documentation for the complete option list.

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

Before capture, ScreenshotNeo accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and whether the request was billed. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.

You can still control full-page and element captures, dark mode, device or custom viewport, retina scale, PDF paper and page ranges, HTML/CSS input, JavaScript and CSS, clicks, selector hiding, selector or delay waits, network-idle waits, blocked resources, headers, cookies, user agent, authorization, timezone, geolocation, transparency, resizing, chosen cache TTL, signed image links, asynchronous webhooks, bulk requests of up to 100 URLs, and usage reporting. Every feature is included on every plan. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots, with yearly billing providing two months free. Create a free ScreenshotNeo account.

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

FAQ

Does waiting for load guarantee that JavaScript has rendered?

No. It describes document loading, not completion of hydration or API-driven UI updates. Gate capture on the rendered state you need.

Can I use a CSS selector instead of a role locator?

Yes. Use a stable selector such as [data-testid="results"]; semantic role and text locators are often easier to maintain when the markup supports them.

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.

Why is an iframe visible but not found by my locator?

The iframe has its own document. Address it with page.frameLocator(...) or the matching frame object and perform the wait there.

What should a readiness timeout tell me?

It should identify the missing UI condition. That narrows investigation to routing, authentication, JavaScript errors, blocked requests, frame selection, or an application state that never occurred.

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.

Frequently Asked Questions

Does waiting for `load` guarantee that JavaScript has rendered?

No. It describes document loading, not completion of hydration or API-driven UI updates. Gate capture on the rendered state you need.

Can I use a CSS selector instead of a role locator?

Yes. Use a stable selector such as `[data-testid=”results”]`; semantic role and text locators are often easier to maintain when the markup supports them.

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

Why is an iframe visible but not found by my locator?

The iframe has its own document. Address it with `page.frameLocator(…)` or the matching frame object and perform the wait there.

What should a readiness timeout tell me?

It should identify the missing UI condition. That narrows investigation to routing, authentication, JavaScript errors, blocked requests, frame selection, or an application state that never occurred.

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.