SnapRender
  1. Home
  2. Blog
  3. Full-Page Screenshots Missing Images? How to Capture Lazy-Loaded Pages

Full-Page Screenshots Missing Images? How to Capture Lazy-Loaded Pages

Puppeteer and Playwright full-page screenshots leave lazy-loaded images blank. We tested 7 sites: up to 64 of 77 images were missing. The scroll-through fix in Node.js and Python, and three shortcuts that fail.

You call page.screenshot({ fullPage: true }), open the file, and the top of the page looks right. Further down there are gray boxes, blurry placeholders or empty cards where the product photos should be.

Nothing is broken in your code. The page is lazy loading its images, and a full-page screenshot never triggers the loads. This guide shows what we measured on real sites, the fix in Node.js and Python (both snippets were run while writing this), and three shortcuts that look simpler and fail on real pages.

Try it on your URL

Live capture, no signup. You get the screenshot and the exact API call that produced it.

Quick answer

Before the screenshot, do what a visitor does:

  1. Scroll down through the page one screen at a time, with a short pause per step.
  2. Stop at the height you plan to capture (infinite feeds never end).
  3. Scroll back to the top.
  4. Wait, with a time limit, for the image requests to finish and fade-ins to end.
  5. Take the full-page screenshot.

Or skip the setup entirely

Everything in this guide is one GET request with SnapRender. No browser to babysit, no timeouts to tune.

200 screenshots a month free. First render in under a minute.

Grab a free API key

What we measured

We loaded 9 public pages in headless Chrome at 1280×800 and counted images (at least 40×40 px on the page) that were still empty at the moment of the capture. Two sites served a bot check page to the headless browser and are left out. Puppeteer 25.19 with Chrome 158:

Page Images Plain full page Scroll first loading=eager Tall viewport
The Verge, homepage 77 64 empty 0 0 22
IKEA, chairs category 46 21 4 0 4
GitHub, homepage 16 12 0 0 0 (page grew 1,099 px)
BBC News 33 11 0 0 0
Apple, iPhone page 10 8 0 8 0
dev.to, homepage 4 0 0 0 0
web.dev, lazy loading article 7 0 0 0 0

Every row above is one GET request away. 200 free renders a month, no card.

Start free

Playwright 1.65 (Python) with full_page=True behaves the same way. It does not scroll for you:

Page Plain full_page=True Scroll first
The Verge 53 of 77 empty 0
IKEA 9 of 46 0
GitHub 8 of 16 0
BBC News 6 of 28 0
Apple iPhone 8 of 10 0

Counts vary a little between runs because these pages rotate stories and products, but the direction never changed: 5 of the 7 pages lost images without the scroll, and the scroll fixed all of them except 4 IKEA images in one Puppeteer run.

One more number explains why: we counted the empty images again right after each screenshot. The count was the same before and after. Taking a full-page screenshot does not make the browser fetch anything.

Why full-page screenshots miss lazy images

Pages delay images in two ways:

  • Native lazy loading. <img loading="lazy"> tells Chrome to fetch the image only when it gets within a certain distance of the viewport.
  • JavaScript loaders. The real URL sits in data-src (or the image element does not exist yet), and an IntersectionObserver swaps it in when the element scrolls into view. Scroll-reveal effects work the same way.

A full-page screenshot in Puppeteer and Playwright does not scroll the page. Chrome renders the whole document height into one image, but from the page's point of view the visitor is still looking at the first screen. Native lazy images far below never get close enough, and the observers never fire. That is why dev.to and web.dev came out complete (their images are close enough or loaded eagerly), while The Verge, which loads almost everything on scroll, lost 64 of 77.

The fix in Node.js (Puppeteer)

npm install puppeteer
import puppeteer from 'puppeteer';

async function loadLazyContent(page, { maxHeight = 20000, scrollTimeoutMs = 10000 } = {}) {
  // Walk down the page one screen at a time, like a visitor would.
  await page.evaluate(async (maxHeight, scrollTimeoutMs) => {
    const started = Date.now();
    const step = window.innerHeight;
    const end = Math.min(document.documentElement.scrollHeight, maxHeight);
    for (let y = step; y < end && Date.now() - started < scrollTimeoutMs; y += step) {
      window.scrollTo(0, y);
      await new Promise((r) => setTimeout(r, 150)); // give lazy loaders a moment to react
    }
    window.scrollTo(0, 0);
  }, maxHeight, scrollTimeoutMs);

  // Wait for the image requests the scroll started, but never forever.
  await page.waitForNetworkIdle({ idleTime: 500, timeout: 8000 }).catch(() => {});

  // Short pause for images that fade in after loading.
  await new Promise((r) => setTimeout(r, 500));
}

const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 800 });
await page.goto('https://github.com/', { waitUntil: 'networkidle2' });
await loadLazyContent(page);
await page.screenshot({ path: 'github-full.png', fullPage: true });
await browser.close();

What each part is for:

  • Steps of one viewport height. Every part of the page passes through the viewport once, which is exactly what native lazy loading and observers wait for. Jumping straight to the bottom skips the middle.
  • Back to the top before the capture. Sticky headers, "back to top" buttons and some carousels position themselves from the scroll offset. Capturing while scrolled to the bottom gives you a header in the wrong place.
  • Every wait has a limit. Some pages never go quiet on the network (analytics beacons, long polling). An unbounded networkidle wait turns into a timeout error instead of a screenshot.

The fix in Python (Playwright)

pip install playwright
playwright install chromium
from playwright.sync_api import sync_playwright

SCROLL_THROUGH = """async ([maxHeight, scrollTimeoutMs]) => {
  const started = Date.now();
  const step = window.innerHeight;
  const end = Math.min(document.documentElement.scrollHeight, maxHeight);
  for (let y = step; y < end && Date.now() - started < scrollTimeoutMs; y += step) {
    window.scrollTo(0, y);
    await new Promise(r => setTimeout(r, 150));
  }
  window.scrollTo(0, 0);
}"""

def load_lazy_content(page, max_height=20000, scroll_timeout_ms=10000):
    page.evaluate(SCROLL_THROUGH, [max_height, scroll_timeout_ms])
    try:
        page.wait_for_load_state("networkidle", timeout=8000)
    except Exception:
        pass  # some pages never go fully quiet (analytics, long polling)
    page.wait_for_timeout(500)

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page(viewport={"width": 1280, "height": 800})
    page.goto("https://github.com/", wait_until="load")
    load_lazy_content(page)
    page.screenshot(path="github-full.png", full_page=True)
    browser.close()

Note the wait_until="load". Playwright's networkidle means no requests at all for 500 ms, and The Verge's homepage never reached that in 45 seconds in our test. Load first, then wait for quiet with a timeout you control.

Three shortcuts that fail

1. Switching every image to loading="eager"

await page.evaluate(() => document.querySelectorAll('img[loading=lazy]').forEach((i) => { i.loading = 'eager'; }));

It fixed The Verge, IKEA and GitHub in our table, and did nothing on Apple's iPhone page (8 of 10 images still empty). Apple, like many marketing pages, adds its images from JavaScript when a section scrolls into view, so there is no loading attribute to change.

2. Making the viewport as tall as the page

const height = await page.evaluate(() => document.documentElement.scrollHeight);
await page.setViewport({ width: 1280, height });

Everything is "in the viewport", so in theory everything loads. In practice sections sized with 100vh stretch along with the viewport: GitHub's homepage grew from 8,472 to 9,571 px, pushing content down again. The Verge still had 22 empty images. And the layout you capture is no longer what a visitor on a 1280×800 screen sees.

3. A fixed sleep

await new Promise(r => setTimeout(r, 5000)) waits for requests that were never started. Without scrolling, nothing below the first screens begins to load, so the extra five seconds change nothing. With scrolling, a bounded network wait is both faster and more reliable than a guess.

Edge cases worth handling

  • Infinite feeds. Scrolling dev.to's homepage grew it from 5,451 to 8,459 px as more posts loaded. Decide the maximum height first and never scroll past it, or the capture keeps growing until something times out.
  • Very tall output. JPEG tops out at 65,535 px in one dimension and WebP at 16,383 px, and a 20,000 px PNG at 1280 wide is easily 10 MB or more. Cap the capture height to what you need.
  • Fade-ins. Images that just arrived often animate from transparent. Capturing in the middle of that gives you half-visible photos, which is why both examples pause briefly before the capture.
  • Cookie banners and chat widgets are separate problems. See how to block cookie banners in screenshots.
  • Horizontal carousels. Slides off to the side never enter the viewport by vertical scrolling. That is likely where IKEA's last 4 images were. If a carousel matters, click through it or capture that element on its own.

With an API: one parameter

If you capture many different sites, keeping that scroll logic tuned (and the browsers running) is ongoing work. With SnapRender it is one parameter on a full-page capture:

curl "https://app.snap-render.com/v1/screenshot?url=https://www.theverge.com&full_page=true&lazy_load=true&format=jpeg" \
  -H "X-API-Key: YOUR_API_KEY" \
  --output verge-full.jpg

lazy_load=true makes lazy-loaded images and scroll-triggered sections appear in the full-page capture. In our runs it added 2.3 to 2.8 seconds (GitHub: 3.3 s without, 5.8 s with) and the files got bigger, because the images were actually in them. It is off by default, since most pages don't need it and it costs those seconds. It works on scheduled captures too.

import requests

r = requests.get(
    "https://app.snap-render.com/v1/screenshot",
    params={"url": "https://www.theverge.com", "full_page": "true", "lazy_load": "true", "format": "jpeg"},
    headers={"X-API-Key": "YOUR_API_KEY"},
    timeout=90,
)
r.raise_for_status()
open("verge-full.jpg", "wb").write(r.content)

A free SnapRender key includes 200 captures a month with no card. Get a key and compare a capture with and without lazy_load on a page you care about.

Summary

  • Full-page screenshots in Puppeteer and Playwright do not scroll, so lazy images below the first screens stay empty. On 5 of 7 sites we tested, that cost between 8 and 64 images.
  • Scrolling through the page in viewport steps, returning to the top and waiting with limits fixed every case except 4 IKEA images in one run (most likely a horizontal carousel).
  • loading="eager" misses JavaScript loaders, a tall viewport stretches 100vh layouts, and a fixed sleep waits for requests that never started.
  • Cap the scroll height for infinite feeds and the output height for file size.

Related: full-page screenshots in Node.js, screenshot a website with Python, Puppeteer screenshot guide.

Frequently asked questions

Why are images missing in my Puppeteer full-page screenshot?

A full-page screenshot never scrolls. Images with loading="lazy" and JavaScript lazy loaders only start downloading when they come near the viewport, so everything below the first screen or two is still empty when Chrome paints the capture. Scroll through the page first, wait for the requests to finish, then take the screenshot.

Does Playwright load lazy images before a full_page screenshot?

No. In our test with Playwright 1.65, full_page=True left 53 of 77 images empty on The Verge's homepage and 8 of 16 on GitHub's. After scrolling through the page first, none were missing.

Can I just set every image to loading=eager?

It only works for native lazy loading. Pages that insert images from JavaScript when a section scrolls into view ignore it: on Apple's iPhone page 8 of 10 images stayed empty. Switching everything to eager can also make very long pages heavy enough to break size limits.

How do I screenshot a page with infinite scroll?

Cap the scroll range. Scroll only through the height you intend to capture (for example 20,000 px) and stop there, otherwise each scroll step loads more items and the page never ends.

How long does the scroll-through add?

About 2 to 3 seconds on a typical long page in our tests (GitHub's 8,472 px homepage: 3.3 s without, 5.8 s with). Very long pages take longer, which is why the scroll should have a time limit.

Or skip the setup entirely

200 screenshots a month free. First render in under a minute.