To render lazy-loaded images in headless Puppeteer, scroll the page so each image enters (or approaches) the viewport, then wait for the image elements to report complete and a nonzero naturalWidth before taking the screenshot. The browser’s load event and Puppeteer’s networkidle conditions do not prove that below-the-fold images have loaded. Native lazy loading is deliberately deferred until images are near the viewport, and custom lazy-load scripts may require real scroll or intersection events.
This guide shows a complete implementation, explains why common waits fail, and provides a diagnostic and recovery path for images that remain missing.
Why load and networkidle miss lazy images
An image with loading="lazy" is not requested immediately when the document is parsed. The browser schedules it when its layout position is close enough to the viewport. MDN notes that even lazy images located in the visual viewport may not be visible when the Window load event fires (MDN: <img> element). Consequently, a navigation such as page.goto(url, {waitUntil: 'load'}) can finish while many image requests have not started.
networkidle0 and networkidle2 only describe network activity during the period being observed. A later scroll can trigger new requests, and an image can fail even when the network becomes idle. Puppeteer’s screenshot guide uses networkidle2 as a navigation example, not as a universal “all dynamic content is ready” signal (Puppeteer screenshots).
#1 Best Overall
- Compatible with Nintendo Switch 2’s new GameChat mode
- Auto-Light Balance: RightLight boosts brightness by up to 50%, reducing shadows so you look your best—compared to previous-generation Logitech webcams (1)
- Privacy with a Slide: The integrated webcam cover makes it easy to get total, reliable privacy when you're not on a video call
- Built-In Mic: The built-in microphone lets others hear you clearly during video calls
- Easy Plug-And-Play: The Brio 101 works with most video calling platforms, including Microsoft Teams, Zoom and Google Meet—no hassle; it just works
The reliable sequence is therefore: navigate, trigger the page’s lazy-load mechanism, wait on the actual image elements, and only then capture.
A complete Puppeteer implementation
The following script uses Puppeteer 25.12.0-compatible APIs. It navigates after the initial DOM is available, scrolls in measured increments, returns to the top, and waits for every image to finish with a usable intrinsic width. Adapt the URL, viewport, and timeout to your page.
import puppeteer from 'puppeteer';
const url = 'https://example.com/long-page';
const browser = await puppeteer.launch({
headless: true,
// Use headless: false temporarily when diagnosing visual differences.
});
try {
const page = await browser.newPage();
await page.setViewport({ width: 1440, height: 900, deviceScaleFactor: 1 });
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 });
// Trigger native loading and most scroll/intersection handlers.
await page.evaluate(async () => {
const step = Math.max(window.innerHeight * 0.75, 200);
const pause = ms => new Promise(resolve => setTimeout(resolve, ms));
const bottom = () => document.documentElement.scrollHeight;
for (let y = 0; y < bottom(); y += step) {
window.scrollTo(0, y);
await pause(100);
}
window.scrollTo(0, bottom());
await pause(300);
window.scrollTo(0, 0);
});
await page.waitForFunction(
() => [...document.images].every(img => img.complete && img.naturalWidth > 0),
{ timeout: 15000 }
);
await page.screenshot({ path: 'page.png', fullPage: true });
} finally {
await browser.close();
}
The naturalWidth > 0 test distinguishes a completed successful image from a completed failed request. If your page intentionally contains broken images, replace the all-images condition with a selector for the images required by the capture.
Install and run
npm install puppeteer
node capture.mjs
If your project uses CommonJS, replace the import with const puppeteer = require('puppeteer'); and keep the rest of the flow the same.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesTrigger lazy loading with the right kind of scroll
Incremental document scrolling
Incremental scrolling is the safest default for long pages. It gives each image a chance to approach the viewport and fires scroll events in applications that listen for them. A single jump from position zero to the bottom can bypass code that expects intermediate positions. The example pauses briefly between steps; increase that pause for pages that do expensive layout or JavaScript work.
Rank #2
- Compatible with Nintendo Switch 2’s new GameChat mode
- Crisp HD 720p/30 fps video calls with diagonal 55° field of view and auto light correction. Compatible with popular platforms including Skype and Zoom.
- The built-in noise-reducing mic makes sure your voice comes across clearly up to 1.5 meters away, even if you’re in busy surroundings.
- C270’s RightLight 2 feature adjusts to lighting conditions, producing brighter, contrasted images to help you look good in all your conference calls.
- The adjustable universal clip lets you attach the camera securely to your screen or laptop, or fold the clip and set the webcam on a shelf. You’re always ready for your next video call.
Scrolling individual elements
When only selected images matter, Puppeteer locators can scroll an element into view. Locator scrolling uses mouse-wheel interaction and ensures the target is in the viewport for relevant interactions (Puppeteer page interactions).
const images = await page.locator('main img').all();
for (const image of images) {
await image.scroll();
await new Promise(resolve => setTimeout(resolve, 100));
}
This approach is convenient for a known subset, but iterating hundreds of elements can be slower than one measured document scroll.
Direct JavaScript scrolling
window.scrollTo() is often faster and works well with native loading="lazy". It may not reproduce handlers that depend on mouse-wheel input, debounced scroll events, or a particular intersection sequence. Use it first for performance, then switch to locator or wheel-style scrolling when a site’s custom loader does not react.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
| Approach | Best fit | Trade-off |
|---|---|---|
Measured window.scrollTo steps |
Native lazy loading and most scroll listeners | Fast; may not mimic every user interaction |
Locator scroll() |
Specific images or interaction-driven loaders | More realistic; potentially slower for many images |
| One large jump | Quick diagnostic only | Can skip incremental or debounced application logic |
Wait for the images themselves
MDN documents the Boolean complete property as an image-loading check (MDN lazy loading). In production code, pair it with naturalWidth > 0, a timeout, and a useful failure report.
await page.waitForFunction(
(selector) => {
const required = [...document.querySelectorAll(selector)];
return required.length > 0 &&
required.every(img => img.complete && img.naturalWidth > 0);
},
{ timeout: 20000 },
'main img[data-critical]'
);
For diagnostics, inspect the state before and after scrolling:
Rank #3
- 【Full HD 1080P Webcam】Powered by a 1080p FHD two-MP CMOS, the NexiGo N60 Webcam produces exceptionally sharp and clear videos at resolutions up to 1920 x 1080 with 30fps. The 3.6mm glass lens provides a crisp image at fixed distances and is optimized between 19.6 inches to 13 feet, making it ideal for almost any indoor use.
- 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 8, 10 & 11 / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
- 【Built-in Noise-Cancelling Microphone】The built-in noise-canceling microphone reduces ambient noise to enhance the sound quality of your video. Great for Zoom / Facetime / Video Calling / OBS / Twitch / Facebook / YouTube / Conferencing / Gaming / Streaming / Recording / Online School.
- 【USB Webcam with Privacy Protection Cover】The privacy cover blocks the lens when the webcam is not in use. It's perfect to help provide security and peace of mind to anyone, from individuals to large companies. 【Note:】Please contact our support for firmware update if you have noticed any audio delays.
- 【Wide Compatibility】Works with USB 2.0/3.0, no additional drivers required. Ready to use in approximately one minute or less on any compatible device. Compatible with Mac OS X 10.7 and higher / Windows 7, 10 & 11, Pro / Android 4.0 or higher / Linux 2.6.24 / Chrome OS 29.0.1547 / Ubuntu Version 10.04 or above. Not compatible with XBOX/PS4/PS5.
const states = await page.$$eval('img', imgs => imgs.map(img => ({
alt: img.alt,
loading: img.loading,
src: img.getAttribute('src'),
currentSrc: img.currentSrc,
complete: img.complete,
naturalWidth: img.naturalWidth,
rect: (() => { const r = img.getBoundingClientRect();
return { width: r.width, height: r.height, top: r.top + scrollY };
})()
})));
console.table(states);
Use currentSrc to see which responsive candidate actually loaded. A changed src or srcset after scrolling confirms that the page’s loader was triggered.
When an image never loads
Zero-sized layout boxes
A lazy image with no usable width or height may never intersect the browser’s loading area. Check the rectangle reported by getBoundingClientRect(). The MDN guidance recommends width and height attributes because zero-sized lazy images can fail to intersect (MDN: <img> element). If you control the page, add dimensions or an aspect-ratio box. If not, inspect the parent’s CSS and any collapsed containers.
Custom source assignment
Some libraries keep the real URL in data-src, data-srcset, or a JavaScript state object. Scrolling alone cannot help if the script has not assigned a source. Look for a source change after scrolling and check the browser console for script errors.
Failed or blocked requests
A nonzero complete value can also accompany a failed request, which is why naturalWidth matters. Verify the URL directly, examine response status and console errors, and check whether authentication, referrer policy, a content-security policy, robots-related middleware, or an ad/tracker blocker is interfering. A request that is blocked is not a Puppeteer waiting problem.
Headless implementation differences
Puppeteer documents that chrome-headless-shell does not completely match regular Chrome (Puppeteer headless modes). Record your Puppeteer and browser versions, compare headless: true with headless: false, and test the regular Chrome headless mode when the page works visibly but not in automation. Treat a headful run as a diagnostic comparison, not as the production fix.
Rank #4
- 1080P Webcam with Cover for Video Calls - EMEET computer webcam provides design and Optimization for professional video streaming. Realistic 1920 x 1080p video, 5-layer anti-glare lens, providing smooth video. C960 computer camera delivers 1920x1080 video with fixed focus (11.8–118.1 inches), so as to provide a clearer image. C960 USB webcam has a cover and can be removed automatically to meet your needs for privacy. For optimal image performance, use the webcam in a well-lit environment.
- Built-in 2 Omnidirectional Mics - EMEET webcam with microphone for desktop features 2 built-in omnidirectional microphones, picking up your voice to create clear audio for communication. When installing the webcam, select EMEET C960 as the default microphone input device in your computer and video applications and select C960 as the default device in Zoom/Teams and ensure microphone permissions are enabled for proper use. Please note that C960 does not include built-in speakers.
- Automatic Light Adjustment - Automatic exposure adjustment is applied in EMEET HD webcam 1080p so that the streaming webcam can deliver stable image performance. EMEET C960 camera for computer also features color adjustment and exposure optimization to help you look your best. For optimal video quality, it is recommended to use the webcam in normal or well-lit environments and select suitable video settings in your application. Proper lighting helps achieve a clearer and more balanced image.
- Plug-and-Play & Upgraded USB Connectivity - New C960 webcam features both USB Type-A & A-to-C adapter connections for wider compatibility. For stable performance, connect the webcam directly to the computer's main USB port and ensure the device is recognized correctly. If a hub or docking station is used, please ensure it provides sufficient power and stable data transmission, as limited ports may affect performance. 90° wide-angle lens captures more participants without frequent adjustments.
- High Compatibility & Multi Application - C960 webcam for laptop is compatible with Windows 10/11, macOS 10.14+, and Android TV 7.0+. Not supported: Windows Hello, TVs, tablets, or game consoles. It works with Zoom, Teams, Facetime, Google Meet, YouTube and more. Please select C960 webcam as the default camera and microphone device in your application and ensure camera/microphone permissions are enabled, especially on macOS. (Tips: Incompatible with Windows Hello)
Timeouts, dynamic pages, and practical reliability
Use bounded waits
Always set navigation and image-wait timeouts. An indefinitely pending image, service worker, or stream should produce a controlled error and diagnostics rather than hang a worker forever. On timeout, save the HTML, the image-state table, a screenshot of the current viewport, and console/request errors.
Recommended Free Tools
Wait for page-specific readiness when available
If the application adds a marker such as data-images-ready="true" or emits a known event after hydration, wait for that marker in addition to the image checks. A page-specific condition is more precise than a generic network-idle window.
Control capture cost
Full-page screenshots require the page to lay out the entire document and can be expensive on very long pages. If only a component is needed, wait for that selector and capture the element. Puppeteer will attempt to scroll a hidden element into view, but you should still verify the element’s images explicitly.
Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server when you do not want to maintain browser orchestration. Its full-page capture loads lazy images, and you can also wait for a selector, delay, or network idle, inject custom JavaScript, click an element, hide selectors, block selected requests or resource types, and choose PNG, JPEG, WebP, or PDF output. Before capture it accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled.
Only clean shots are billed. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers identify the page verdict and billing result. An MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated 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 matchUse the documented API parameters and see the complete option list at ScreenshotNeo documentation.
Best Value
- Compatible with Nintendo Switch 2’s new GameChat mode
- HD lighting adjustment and autofocus: The Logitech webcam automatically fine-tunes the lighting, producing bright, razor-sharp images even in low-light settings. This makes it a great webcam for streaming and an ideal web camera for laptop use
- Advanced capture software: Easily create and share video content with this Logitech camera that is suitable for use as a desktop computer camera or a monitor webcam
- Stereo audio with dual mics: Capture natural sound during calls and recorded videos with this 1080p webcam, great as a video conference camera or a computer webcam
- Full HD 1080p video calling and recording at 30 fps. You'll make a strong impression with this PC webcam that features crisp, clearly detailed, and vibrantly colored video
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)
r.raise_for_status()
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}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const data = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', data));
The Free plan includes 1,000 screenshots a month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account.
A production checklist
- Navigate with
domcontentloadedor another initial condition appropriate to the page. - Scroll incrementally, or scroll each required element into view.
- Inspect
loading,src,currentSrc,complete,naturalWidth, and layout dimensions. - Wait with a finite timeout for the required images, not merely for network idle.
- Confirm failed URLs and blocked requests separately from deferred requests.
- Compare regular headless and headful Chrome when implementation behavior differs.
- Capture only after the page-specific image condition succeeds.
Frequently Asked Questions
Should I set every image to loading="eager"?
Only when you control the page and accept the extra network and rendering cost. Triggering the existing lazy loader and waiting for the required images preserves the page’s intended behavior.
Why does naturalWidth stay zero after scrolling?
The request may not have been triggered, the source URL may be invalid or blocked, the image may have a zero-sized layout box, or a custom loader may require a specific event. Inspect currentSrc, dimensions, console errors, and network responses.
Is networkidle2 ever useful?
Yes, as an initial navigation condition or an additional signal after your triggers run. It is not proof that every lazy image on a page is loaded.
Quick 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.




