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

Playwright can take a screenshot before lazy-loaded images have been requested, loaded, and painted. A page’s load event—or a full-page screenshot—does not prove that the particular images you need are ready. Trigger the page’s lazy-loading behavior, wait for an image-specific or application-specific ready condition, and then capture.

Why lazy-loaded images can be blank

Lazy loading commonly postpones an image request until the image is near the viewport or until application code triggers it. A screenshot taken before that trigger, or before the resulting image is ready to display, can therefore show an empty area. A first-run-only failure is consistent with a timing race, but it does not by itself prove that caching is the cause.

Playwright’s waitForLoadState('load') waits for the document’s load event; DOMContentLoaded happens earlier. Neither says that images deferred until later page activity have finished loading. Playwright notes that load-state waits are often unnecessary because actions auto-wait, and discourages using networkidle as a general test-readiness signal (Playwright Page API).

Fix it by triggering and checking the images

  1. Identify the affected images. Determine whether they are below the initial viewport, inside a scrollable container, or created or updated by client-side code. The correct selector and trigger depend on the page.
  2. Trigger the page’s loading behavior. Scroll each required image or its containing section into view. For a custom lazy loader, perform the user-visible action that the application expects.
  3. Wait for the result you need. Check an image-specific condition such as naturalWidth > 0, or use an application-specific loaded marker. Prefer a condition-based assertion over a fixed sleep.
  4. Capture after the condition passes. Use fullPage: true if you want the full scrollable page, but treat screenshot extent and image readiness as separate concerns.

This adaptable JavaScript example uses Playwright Test’s expect assertion:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Dell Optiplex 3060 Desktop Computer | Intel i5-8500 (3.2) | 32GB DDR4 RAM | 1TB SSD Solid State | Built in WiFi | Bluetooth | Windows 11 Professional | Home or Office PC (Renewed)
  • [INTEL POWERED CONTENT] - Built with a 8th Generation Hexa-Core Intel i5 and 32GB of DDR4 RAM; Modern, Windows 11 ready, with 4K support, Executive multitasking, media streaming and smooth, multi-tab web browsing; Perfect as an all-purpose multimedia computer; built for content creators; Plenty of RAM and Mass storage for photo and video editing powered by Intel HD 630
  • [LATEST WIRELESS TECH] - This Dell Desktop Computer easily connects to the internet through the Built In WiFi / Bluetooth
  • [SOLID STATE STORAGE] - This Dell Computer setup comes with an ultra-fast 1TB Solid State Drive (SSD); Setup as the primary boot device; Boot and load programs with lightning speed ; Additional expansion available
  • [BUY & OWN WITH CONFIDENCE] - From the world's largest Microsoft Authorized Refurbisher; Quality Guarantee and Free Tech Support; Award-winning Customer Service; | Support Sustainable Business
  • [MODERN HI-SPEED PORTS] - USB 3.0 (x4) | USB 2.0 (x4) | DisplayPort (x1) | HDMI Port (x1) | Audio Combo Jack (x1) | Audio Out (x1) | RJ-45 Ethernet (x1) | Internal SATA (x3)
const images = page.locator('img[loading="lazy"]');
const count = await images.count();

for (let i = 0; i < count; i++) {
  const image = images.nth(i);
  await image.scrollIntoViewIfNeeded();
  await expect(image).not.toHaveJSProperty('naturalWidth', 0);
}

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

The selector only matches images with a native loading="lazy" attribute. A site may use another selector, defer assigning src, or implement lazy loading in application code. Adapt both the locator and readiness assertion to the target page. Playwright’s issue #31737 shows a scroll-and-naturalWidth approach and notes that collecting a changing set with locator.all() can be unpredictable (Playwright issue #31737).

Diagnose the page before changing waits

For each affected image, inspect src, srcset, currentSrc, loading, complete, and naturalWidth before and after scrolling it into view. This helps distinguish an image that has not yet been assigned a URL from one that was requested but failed, or one that loaded but is not visibly rendered.

Rank #2
Dell Optiplex 7050 SFF Desktop PC Intel i7-7700 4-Cores 3.60GHz 32GB DDR4 1TB SSD WiFi BT HDMI Duel Monitor Support Windows 11 Pro Excellent Condition(Renewed)
  • Model: Dell OptiPlex 7050 Small Form Factor (SFF)
  • Processor: Intel Core i7-7700 3.60 GHz
  • Memory: 32GB DDR4 Ram
  • Storage: 1TB Solid State Drive (SSD) Fast Boot + Storage
  • Operating System: Windows 11 Pro (64-bit)
  • No real image URL: Check src, srcset, currentSrc, and any application data attributes. Some pages assign the image URL only after a trigger.
  • A URL is present but the image fails: Inspect browser console errors and failed network requests. A resource failure needs a different fix from a screenshot taken too early.
  • The image reports loaded but still looks blank: Check CSS visibility and opacity, overlays, image decoding or paint timing, and whether the screenshot targets the intended frame or element.
  • Only the first run fails: Compare cold and warm runs while logging image state. A cache or prior page state may affect timing, but the symptom alone does not establish either as the cause.

Handle changing image lists and visual assertions

If scrolling causes the page to add, remove, or replace images, a count taken once may not describe the same set throughout the loop. Re-query as appropriate or wait for the application’s list to become stable before iterating. The issue report documents one example of this caveat; it is not evidence that every changing locator will fail.

For visual regression tests, first ensure that the application and target images are ready. Playwright Test’s toHaveScreenshot waits for two consecutive screenshots with the same result before comparing them, which stabilizes the visual assertion but does not trigger lazy loading or prove that the intended images loaded (Playwright PageAssertions API).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
HP All-in-OneDesktop Computer, 16GB DDR5 RAM, Intel Quad-Cores, 128GB SSD, WiFi6, Keyboard & Mouse, Windows 11
  • IMMERSIVE 24 INCH DISPLAY: Experience stunning clarity on a Full HD IPS screen with ultra-thin bezels, offering a 90% screen-to-body ratio that makes everything from spreadsheets to streaming come alive with vibrant colors and crisp details.
  • POWERFUL INTEL PROCESSING: Tackle demanding tasks with ease thanks to the Intel processor and 16GB of high-speed memory, delivering smooth performance whether you're multitasking between applications or running productivity software.
  • GENEROUS STORAGE: Store all your important files, photos, and programs with blazing-fast solid state drive technology that ensures quick boot times, rapid file access, and plenty of space for your digital life.
  • ENHANCED PRIVACY AND COLLABORATION: Work confidently with the pop-up privacy camera that tucks away when not in use, plus dual microphones with noise reduction for crystal-clear video calls that keep you connected professionally.
  • ECO-CONSCIOUS DESIGN: Feel good about your purchase with an EPEAT Gold registered and ENERGY STAR certified computer that combines premium performance with responsible environmental manufacturing practices.

Or skip the browser setup

If you need a website screenshot without building and maintaining a browser automation flow, ScreenshotNeo takes a screenshot or PDF from one GET request. It accepts cookie or consent banners like a visitor and removes 60+ known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides screenshot tools for AI agents and other MCP clients.

cURL example, saving a WebP screenshot:

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 a month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo.

Troubleshooting quick checks

  • naturalWidth remains zero: Confirm the image has a real URL, trigger lazy loading, and check for request failures before increasing waits.
  • The assertion passes but the captured area is blank: Check visibility, overlays, paint or decode timing, and whether the locator identifies the image actually shown in the screenshot.
  • A fixed delay seems to help intermittently: Replace it with a condition tied to the image or app state; network and page timing can vary.
  • networkidle does not solve it: It is not a reliable proxy for the readiness of a particular lazy image. Wait for the target content instead.
  • The visual snapshot remains flaky: Establish app and image readiness first, then use screenshot assertion stabilization and control other changing visual elements.

The exact trigger and ready condition cannot be determined without the page’s URL, markup, framework, and loading implementation. Playwright guidance applies generally; issue #31737 is a specific GitHub Actions/Chromium example, not a guarantee about every browser or environment.

Rank #4
Dell Optiplex 3050 SFF Desktop Computer PC, Intel Quad Core i5-6500 up to 3.6GHz, 16GB DDR4, 256GB SSD, WiFi, 4K Support, DP, HDMI, Windows 11 Pro 64 Bit (Renewed)
  • This Certified Refurbished product is tested and certified to look and work like new. The refurbishing process includes functionality testing, basic cleaning, inspection, and repackaging. The product ships with all relevant accessories, a minimum 90-day warranty, and may arrive in a generic box. Only select sellers who maintain a high-performance bar may offer Certified Refurbished products on Amazon.com.
  • Dell Optiplex 3050 SFF Desktop computer PC, Intel Quad Core i5-6500 up to 3.6GHz, 16GB DDR4, 256GB SSD
  • Includes: USB Keyboard & Mouse, USB WiFi adapter, Microsoft office 30 days free trail.
  • Port: Front: USB 3.0(2), USB 2.0(2); Rear: DP, HDMI, USB 3.0(2), USB 2.0(2), RJ-45.
  • Support 4K (3840x2160) Dual display, makes it easy to connect two monitors at the same time, and you can expand working Windows, mirror content, or expand a single window across multiple monitors.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

Does fullPage: true load lazy images automatically?

No. It controls the screenshot extent, not whether a page’s lazy-loading behavior has been triggered or whether its images are ready.

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

Should I wait for networkidle before taking the screenshot?

Not as a generic readiness check. Wait for the specific image or application condition the screenshot requires.

Quick Recap

Bestseller No. 2
Dell Optiplex 7050 SFF Desktop PC Intel i7-7700 4-Cores 3.60GHz 32GB DDR4 1TB SSD WiFi BT HDMI Duel Monitor Support Windows 11 Pro Excellent Condition(Renewed)
Dell Optiplex 7050 SFF Desktop PC Intel i7-7700 4-Cores 3.60GHz 32GB DDR4 1TB SSD WiFi BT HDMI Duel Monitor Support Windows 11 Pro Excellent Condition(Renewed)
Model: Dell OptiPlex 7050 Small Form Factor (SFF); Processor: Intel Core i7-7700 3.60 GHz; Memory: 32GB DDR4 Ram
$399.99
Bestseller No. 4
Dell Optiplex 3050 SFF Desktop Computer PC, Intel Quad Core i5-6500 up to 3.6GHz, 16GB DDR4, 256GB SSD, WiFi, 4K Support, DP, HDMI, Windows 11 Pro 64 Bit (Renewed)
Dell Optiplex 3050 SFF Desktop Computer PC, Intel Quad Core i5-6500 up to 3.6GHz, 16GB DDR4, 256GB SSD, WiFi, 4K Support, DP, HDMI, Windows 11 Pro 64 Bit (Renewed)
Includes: USB Keyboard & Mouse, USB WiFi adapter, Microsoft office 30 days free trail.; Port: Front: USB 3.0(2), USB 2.0(2); Rear: DP, HDMI, USB 3.0(2), USB 2.0(2), RJ-45.
$179.98
Bestseller No. 5
Dell Windows 11 Desktop Computer OptiPlex 5060 | Intel Core i5-8500 Six Core (4.3GHz Turbo) | 16GB DDR4 RAM | 500GB SSD Solid State + 1TB HDD | WiFi + Bluetooth | Home or Office PC (Renewed)
Dell Windows 11 Desktop Computer OptiPlex 5060 | Intel Core i5-8500 Six Core (4.3GHz Turbo) | 16GB DDR4 RAM | 500GB SSD Solid State + 1TB HDD | WiFi + Bluetooth | Home or Office PC (Renewed)
Connectivity: Includes WiFi, Bluetooth, and LAN for wireless and wired connections; Memory: Features 16GB DDR4 RAM for smooth multitasking and performance
$255.00
Best Value
Dell Windows 11 Desktop Computer OptiPlex 5060 | Intel Core i5-8500 Six Core (4.3GHz Turbo) | 16GB DDR4 RAM | 500GB SSD Solid State + 1TB HDD | WiFi + Bluetooth | Home or Office PC (Renewed)
  • Connectivity: Includes WiFi, Bluetooth, and LAN for wireless and wired connections
  • Memory: Features 16GB DDR4 RAM for smooth multitasking and performance
  • Storage: Combines 500GB SSD and 1TB HDD for ample storage space
  • Graphics: Integrated Intel UHD Graphics 630 for crisp visuals and video playback
  • Design: Sleek desktop tower with black color and slim profile for modern look

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.