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

Playwright में lazy-load images का भरोसेमंद screenshot लेने के लिए पहले पेज खोलें, पेज को scroll करके उन images को viewport में लाएँ, फिर image के load और decode होने की पुष्टि करके screenshot लें। fullPage: true पूरी scrollable page को capture करता है, लेकिन यह अपने-आप offscreen images लोड होने की गारंटी नहीं देता।

Lazy-loaded images के लिए सही क्रम

  1. पेज को domcontentloaded पर खोलें।
  2. Viewport के पास और अंदर images लाने के लिए document को scroll करें।
  3. Target images का load पूरा होने और decode होने की जाँच करें।
  4. सफल images की पुष्टि के बाद screenshot लें।

HTML का loading="lazy" browser को offscreen images को तब तक टालने का संकेत देता है, जब तक वे उपयोग के लिए अपेक्षित न हों। Browser तय करता है कि image को लोड करने का समय कब है; इसलिए यह किसी एक निश्चित page-load event के बराबर नहीं है। Document का load event भी यह साबित नहीं करता कि हर lazy image लोड हो चुकी है।

पूरे पेज का screenshot: runnable JavaScript उदाहरण

यह उदाहरण document को viewport के लगभग 80% के कदमों में scroll करता है, फिर मौजूद सभी <img> elements के load और decode की जाँच करके पूरी page capture करता है। Playwright के लिए पहले npm install playwright चलाएँ।

import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });

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

// Scroll to stimulate native lazy loading and scroll-triggered loaders.
await page.evaluate(async () => {
  const step = Math.max(1, window.innerHeight * 0.8);
  for (let y = 0; y < document.body.scrollHeight; y += step) {
    window.scrollTo(0, y);
    await new Promise(resolve => setTimeout(resolve, 100));
  }
  window.scrollTo(0, 0);
});

// Check loading and decoding. Keep failures in the result instead of
// letting one broken image prevent the other images from being checked.
const imageResults = await page.locator('img').evaluateAll(async images => {
  return await Promise.all(images.map(async img => {
    try {
      if (!img.complete) {
        await new Promise((resolve, reject) => {
          img.addEventListener('load', resolve, { once: true });
          img.addEventListener('error', reject, { once: true });
        });
      }
      if (img.naturalWidth > 0) await img.decode();
      return { src: img.currentSrc || img.src, loaded: img.complete && img.naturalWidth > 0 };
    } catch {
      return { src: img.currentSrc || img.src, loaded: false };
    }
  }));
});

console.log(imageResults.filter(result => !result.loaded));
await page.screenshot({ path: 'page.png', fullPage: true });
await browser.close();

यह script उन images के URL और status को console में दिखाती है जो सफलतापूर्वक उपलब्ध नहीं हुईं। complete load completion बताने में मदद करता है, लेकिन failed image भी complete हो सकती है; इसलिए सफलता के लिए उदाहरण naturalWidth > 0 भी जाँचता है। decode() का promise resolve होने पर image render के लिए decoded होती है।

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.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

इस उदाहरण को अपने पेज के लिए ढालें

  • https://example.com को अपने target URL से बदलें।
  • यदि पेज में गैर-ज़रूरी या जानबूझकर टूटी images हैं, तो page.locator('img') को target image के अधिक विशिष्ट selector से बदलें।
  • 100 ms का pause केवल scrolling की गति तय करता है; यह readiness की गारंटी नहीं है। असली readiness जाँच image load और decode की है।
  • Production script में कुल समय-सीमा या app-specific wait signal रखें, ताकि अटक गई image अनिश्चित समय तक इंतजार न करवाए।
  • यदि scroll के दौरान नए image elements बनते हैं, तो scrolling के बाद image list लें या साइट की finite completion condition तक scroll-and-check दोहराएँ।

पूरे पेज और किसी element को capture करने में फर्क

तरीका क्या capture होता है कब चुनें
page.screenshot({ fullPage: true }) पूरी scrollable document एक लंबी image के रूप में। जब लक्ष्य पूरा पेज हो और लंबा screenshot स्वीकार्य हो। पहले lazy loading trigger और verify करें।
locator.screenshot() Matched element का screenshot; scrollable element में केवल वर्तमान scrolled हिस्सा। जब किसी component या visible region को capture करना हो। यह nested scroller की छिपी सामग्री को एक shot में नहीं जोड़ता।

Playwright का mouse.wheel() नियंत्रित scrolling के लिए उपलब्ध है। साधारण document scrolling के लिए ऊपर का window.scrollTo() तरीका भी काम आता है। अगर images किसी nested scrolling panel में हैं, तो उसी panel को scroll करें और उसके भीतर की images का इंतजार करें।

Nested scroller के लिए उदाहरण

#gallery को अपने scrollable panel के selector से बदलें। Panel को छोटे कदमों में scroll करें ताकि उसके lazy content को loading का अवसर मिले:

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
const panel = page.locator('#gallery');

await panel.evaluate(async element => {
  const step = Math.max(1, element.clientHeight * 0.8);
  for (let top = 0; top < element.scrollHeight; top += step) {
    element.scrollTop = top;
    await new Promise(resolve => setTimeout(resolve, 100));
  }
  element.scrollTop = 0;
});

const results = await panel.locator('img').evaluateAll(async images => {
  return await Promise.all(images.map(async img => {
    try {
      if (!img.complete) {
        await new Promise((resolve, reject) => {
          img.addEventListener('load', resolve, { once: true });
          img.addEventListener('error', reject, { once: true });
        });
      }
      if (img.naturalWidth > 0) await img.decode();
      return { src: img.currentSrc || img.src, loaded: img.complete && img.naturalWidth > 0 };
    } catch {
      return { src: img.currentSrc || img.src, loaded: false };
    }
  }));
});

console.log(results.filter(result => !result.loaded));
await panel.screenshot({ path: 'gallery.png' });

यह panel का वर्तमान scrolled हिस्सा capture करता है। यदि पूरा panel लंबा है, तो उसके सभी हिस्सों को अलग-अलग capture करने या site-specific तरीका बनाने की जरूरत पड़ सकती है।

Readiness कैसे तय करें—और क्या न मानें

  • load event पर्याप्त नहीं: lazy images उस समय तक जानबूझकर टाली जा सकती हैं, इसलिए event के बाद भी वे बाकी हो सकती हैं।
  • complete और naturalWidth साथ जाँचें: complete अकेले सफलता नहीं बताता; सफल image के लिए सकारात्मक naturalWidth उपयोगी संकेत है।
  • decode() का इंतजार करें: image resource लोड होने के बाद decode की प्रतीक्षा capture से ठीक पहले render-ready स्थिति देती है।
  • networkidle को universal समाधान न मानें: Playwright testing readiness के लिए इसे discouraged बताता है। Image या application की वास्तविक स्थिति assert करें।
  • Infinite scroll को सीमित करें: पूरी feed को बिना stop condition scroll करने से script अनंत चल सकती है। पहले अधिकतम सीमा या app-specific completion condition तय करें।

Generic <img> जाँच CSS background images, iframe के अंदर की images, <picture> के source बदलाव, या application के अपने loader की पुष्टि नहीं करती। ऐसे मामलों में पेज की implementation देखें और उसी content के वास्तविक status signal का इंतजार करें।

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Visual tests में screenshot स्थिरता

Playwright Test का toHaveScreenshot() तुलना से पहले लगातार दो समान screenshots आने तक इंतजार करता है। इससे visual output की स्थिरता में मदद मिलती है, लेकिन स्थिर blank placeholder भी दो बार समान हो सकता है। अपेक्षित images के load और decode की जाँच अलग से करें। Screenshot comparisons के लिए browser, OS, viewport और rendering environment एकसमान रखें, क्योंकि इनमें बदलाव rendering को प्रभावित कर सकते हैं।

आम समस्याएँ और उनके समाधान

लक्षण संभावित कारण क्या करें
Screenshot में नीचे की images गायब हैं। fullPage capture से पहले वे viewport के पास नहीं लाई गईं या decode नहीं हुईं। Document को चरणों में scroll करें; उसके बाद target images का load और decode जाँचें।
एक image का इंतजार कभी खत्म नहीं होता। Image request stalled है, या error event आया है। कुल timeout जोड़ें, failures को अलग दर्ज करें और naturalWidth जाँचें; एक विफल image को बाकी परिणाम छिपाने न दें।
Nested gallery की कुछ सामग्री नहीं दिखती। स्क्रॉल document पर हुआ, panel पर नहीं; या locator screenshot केवल वर्तमान panel हिस्सा लेता है। Panel का अपना scroll position बदलें और जरूरत हो तो हिस्सों को अलग capture करें।
Network idle के बावजूद image गायब है। Network शांत होना इस बात का प्रमाण नहीं कि target image तैयार है; loader app-specific भी हो सकता है। Image element या application की वास्तविक ready condition की जाँच करें, केवल networkidle पर निर्भर न रहें।
Visual test पास है, पर image placeholder ही है। Placeholder लगातार समान screenshots बना सकता है। Screenshot assertion से पहले image load/decode और अपेक्षित content की पुष्टि जोड़ें।
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

अपने browser में scrolling और screenshot pipeline बनाए रखने के बजाय ScreenshotNeo API को एक GET request दें। उदाहरण में target URL के रूप में https://stripe.com है; API key लेकर ScreenshotNeo documentation देखें।

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo capture से पहले cookie/consent banners स्वीकार करता है और 60 से अधिक ज्ञात consent platforms, newsletter popups और chat widgets हटाता है; हर चरण बंद किया जा सकता है। Bot checks/CAPTCHAs, blank pages, timeouts, failed loads और cache hits के लिए शुल्क नहीं लिया जाता, और response में X-Page-Verdict तथा X-Billed headers बताते हैं कि क्या हुआ। Claude, Cursor और अन्य MCP clients के लिए इसका MCP server take_screenshot, get_page_info और capture_pdf tools देता है। Free plan में हर महीने 1,000 screenshots बिना card के मिलते हैं; paid plans $5 में 3,000 से शुरू होते हैं। Free account बनाएं और 1,000 screenshots प्रति माह बिना card के आजमाएँ।

Frequently Asked Questions

क्या fullPage: true खुद lazy images लोड करता है?

नहीं। यह पूरी scrollable page capture करता है; capture से पहले images को trigger और verify करना अलग कदम है।

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

क्या सिर्फ img.complete सफलता की पुष्टि करता है?

नहीं। Failed image भी complete हो सकती है। सफल load के लिए naturalWidth > 0 जाँचें और render readiness के लिए decode() का इंतजार करें।

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

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.