October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

Playwright Screenshots Missing Images Loaded After Scrolling: How to Fix It

Make Playwright load scroll-triggered images before capturing a full-page screenshot: scroll gradually, wait for real readiness signals, and check image success.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

page.screenshot({ fullPage: true }) captures the page’s full scrollable height, but it does not necessarily scroll through the page to trigger lazy-loaded images. Scroll through the content in steps, wait for the relevant images to finish loading successfully, then capture. For pages that add more content as you scroll, continue until an application-specific condition—or a bounded stop condition—is reached.

Why a full-page screenshot can still miss images

Full-page capture controls how much of the document is included in the screenshot; it is not a guarantee that every deferred resource has loaded. Native lazy loading postpones offscreen image requests until the browser estimates they are close to being needed. The document’s load event can fire while such images remain unloaded. MDN’s lazy-loading guidance explains this browser behavior.

As an Amazon Associate I earn from qualifying purchases.

Scrolling gradually brings content into or near the viewport and can trigger native lazy loading, intersection observers, and scroll-based application code. Afterward, check image readiness rather than assuming a delay or the page-load event means the images succeeded.

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

Use gradual scrolling, then verify image success

This Playwright JavaScript helper scrolls in steps, allows scroll-triggered code a brief opportunity to run, waits for the image elements present at the end to settle, checks for broken images, returns to the top, and takes a full-page screenshot.

#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
async function loadImagesBeforeScreenshot(page) {
  await page.evaluate(async () => {
    const pause = ms => new Promise(resolve => setTimeout(resolve, ms));
    const step = Math.max(200, Math.floor(window.innerHeight * 0.8));
    let previousHeight = 0;
    let stableRounds = 0;

    // Keep scrolling while height grows; cap the loop for safety.
    for (let i = 0; i < 80 && stableRounds < 3; i++) {
      window.scrollBy(0, step);
      await pause(150);
      const height = document.documentElement.scrollHeight;
      stableRounds = height === previousHeight ? stableRounds + 1 : 0;
      previousHeight = height;
    }

    window.scrollTo(0, 0);
  });

  const failures = await page.evaluate(async () => {
    const images = [...document.images];
    await Promise.all(images.map(img => {
      if (img.complete) return Promise.resolve();
      return new Promise(resolve => {
        img.addEventListener('load', resolve, { once: true });
        img.addEventListener('error', resolve, { once: true });
      });
    }));
    return images
      .filter(img => img.currentSrc && img.naturalWidth === 0)
      .map(img => img.currentSrc);
  });

  if (failures.length) {
    throw new Error(`Images failed to load: ${failures.join(', ')}`);
  }

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

Call the helper after navigating to the page and before taking the screenshot. The 150 ms pause is a small opportunity for scroll-triggered application code to run; it is not used as proof that images loaded. Image completion and the naturalWidth check provide that signal. If the application exposes a more meaningful readiness signal, such as a known item count or a loading indicator disappearing, wait for that instead.

What the checks mean

  • img.complete indicates that loading has finished, including when an image failed. It does not prove the image is usable.
  • img.naturalWidth > 0 is a useful success check for an image that should contain image data. A zero width identifies a failed or unusable image in this check.
  • document.images covers HTML image elements, not CSS background images. If the page uses background images, inspect the relevant elements and wait for their resources using an application-specific check.

The helper is a starting point, not a universal lazy-loading utility supplied by Playwright. Its bounded loop stops after 80 scrolls or three rounds without a change in document height. A fixed-height page may use a simpler loop bounded by its known height. For an infinite-scroll page, a known item count, an application-ready signal, or a loading indicator is more reliable than relying only on height.

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

Adapt the method to the page’s loading behavior

Finite page with ordinary lazy images

Use incremental scrolling through the page, then wait for the images that matter and verify successful loading. Returning to the intended capture position before the screenshot avoids leaving the page scrolled if you are taking a viewport-only capture; for a full-page capture, the helper returns to the top as well.

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

Infinite scroll or content added on demand

Scrolling may append items, change the page height, or replace existing DOM nodes. Prefer waiting after each scroll for the site’s actual signal—for example, a target item count or a spinner to disappear—then continue until the desired content is present. The sample gathers image elements present at the end, so adapt it if the application replaces earlier nodes or if images must be checked as each batch appears.

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.

Nested scrolling container or application action

If the content sits inside a nested scrollable element, scrolling window will not bring it into view. Identify and scroll that container instead. Some sites load content only after a particular click or other user action; reproduce that action rather than assuming window scrolling will trigger it.

Full-page versus viewport capture

Use fullPage: true when the desired output is the entire scrollable document. Omit it when you want only the current viewport. In either case, make the required content ready before capture: choosing the full-page extent does not itself trigger deferred content loading. See the Playwright Page API for screenshot options.

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

Why common waiting approaches fail

  • Only setting fullPage: true: this requests a full-height screenshot; it does not make the page’s deferred images load.
  • Waiting for navigation or load: lazy images may still be outstanding when the load event fires.
  • Waiting for networkidle: Playwright discourages using this as a general readiness test. Polling or persistent connections can also make network quietness a poor proxy for whether the required content is ready. Wait for a meaningful element, image, or application signal instead.
  • Using only a fixed timeout: elapsed time does not prove a particular image loaded, and fixed waits can make tests flaky. Use a short delay only when needed to let scroll-triggered code run; assert the relevant condition separately.
  • Checking only complete: a broken image can be complete. Check naturalWidth when successful image data matters.
  • Scrolling only the main window: the relevant content may be in a nested scroller, loaded by an application action, or represented as a CSS background.

For visual regression, Playwright’s screenshot assertions wait for consecutive screenshots to match before comparison. That can help stabilize a visual baseline, but it does not trigger images or other content the page has not loaded.

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

Debug missing images systematically

  1. Confirm what is missing. Check whether the image is an <img>, a CSS background, or content inserted only after an action. Confirm that the element exists in the DOM.
  2. Identify the actual trigger. Determine whether loading depends on viewport proximity, a scroll event, a nested scroll container, or an application action.
  3. Scroll in the relevant place. Move through the content gradually so intermediate viewport-sensitive triggers have a chance to run.
  4. Wait for a specific completion signal. For image elements, check completion and successful dimensions; for dynamically added content, use an item count, spinner state, or app readiness condition.
  5. Restore the capture position and take the screenshot. Use fullPage: true only when you want the whole document.
  6. Stabilize the environment for visual comparisons. Keep browser engine, viewport, device scale, and test host aligned with the environment used for the visual baseline.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo is a screenshot API and MCP server for developers. Its full-page capture loads lazy images. One GET request can return an image or PDF; see the API 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

ScreenshotNeo accepts cookie and consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Sign up for 1,000 free screenshots a month, with no card required.

Frequently Asked Questions

Why does img.complete return true for a missing image?

It also becomes true after a failed load. Check naturalWidth as well when you need to confirm usable image data.

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

Will Playwright’s screenshot assertion load lazy images for me?

No. It can wait for consecutive screenshots to match, but the page still needs to load the required content before the assertion.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.