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

How to Trigger Lazy Loading Without Moving the Page in Puppeteer

Puppeteer has no universal no-scroll lazy-loading switch. Inspect or instrument the page’s observer behavior, verify the content and scroll position, and use scroll-and-restore only when temporary movement is acceptable.

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.

There is no documented Puppeteer command that universally forces arbitrary lazy-loaded content to load while keeping the page at the same scroll position. For a site that uses IntersectionObserver, you can inspect or instrument its observer callbacks with page.evaluate() or page.evaluateOnNewDocument(), but that is a site-specific workaround—not a genuine visibility event or a guarantee the content will load. Verify both that the content appeared and that window.scrollY stayed unchanged.

Why lazy loading and a fixed scroll position can conflict

Many pages defer images or other content until it approaches or enters the viewport. A common implementation uses IntersectionObserver, which reports when an element intersects a viewport or another configured region. If the target is below the viewport and the page does not move, it may never become visible to the observer. Google’s guidance describes loading relevant lazy content when it becomes visible in the viewport: Google Search Central’s lazy-loading guide.

As an Amazon Associate I earn from qualifying purchases.

Puppeteer lets you execute JavaScript in the page, but that does not make off-screen content genuinely visible. Manually invoking an observer callback may miss other conditions in the site’s loading logic. The Puppeteer APIs provide useful hooks for diagnosis and site-specific instrumentation, not a universal no-scroll trigger.

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

Inspect and verify the page without moving it

Start by recording the current scroll position and checking whether the expected content has loaded. The following example is runnable in a Puppeteer script after you have created a page and navigated to the target URL:

#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 before = await page.evaluate(() => window.scrollY);

const state = await page.evaluate(() => ({
  scrollY: window.scrollY,
  imageCount: document.images.length,
  images: [...document.images].map(img => ({
    src: img.currentSrc || img.src,
    loaded: img.complete && img.naturalWidth > 0,
    loading: img.getAttribute('loading'),
    dataSrc: img.getAttribute('data-src')
  }))
}));

console.log({ before, state });

This is diagnostic, not a lazy-loading trigger. Lazy loaders may keep a URL in a different attribute, create elements later, or load non-image content. Adapt the inspection to the site’s markup and application code. Puppeteer’s page.evaluate() runs the function in page context and waits if the function returns a promise; see the Puppeteer Page API.

Try site-specific observer instrumentation

Install instrumentation before page scripts run

If you need to observe or wrap IntersectionObserver as the page initializes, register a script before navigation. page.evaluateOnNewDocument() runs code before the page’s own scripts on navigation. This example logs observer entries while preserving the original callback and observer behavior:

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)
await page.evaluateOnNewDocument(() => {
  const OriginalIntersectionObserver = window.IntersectionObserver;
  if (!OriginalIntersectionObserver) return;

  window.IntersectionObserver = class extends OriginalIntersectionObserver {
    constructor(callback, options) {
      super((entries, observer) => {
        console.debug('IntersectionObserver entries', entries.map(entry => ({
          target: entry.target,
          isIntersecting: entry.isIntersecting,
          ratio: entry.intersectionRatio
        })));
        callback(entries, observer);
      }, options);
    }
  };
});

await page.goto('https://example.com');

Replace the example URL with the page you control or are authorized to inspect. This wrapper is for diagnosis: it does not make a below-viewport element intersect, nor does logging itself cause the site to load content. Wrapping browser APIs can also interact unexpectedly with site code, so compare behavior with and without the instrumentation.

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

Manually invoking callbacks is not equivalent to visibility

A more aggressive workaround is to intercept observer callbacks and call them with fabricated entries for selected elements. Such entries do not represent a real viewport intersection. The site may additionally check element geometry, network state, a data attribute, or another condition before loading. The Puppeteer documentation does not establish this as a general way to trigger lazy loading. Use it only when you understand the specific site implementation, and confirm that the desired content actually appeared.

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.

For page-context inspection or a site-specific adjustment, page.evaluate() can read or modify DOM state without using Puppeteer’s element interactions. Keep in mind that changing an image’s source attribute manually tests a different path than allowing the site’s own lazy loader to run.

Confirm the result and the final scroll position

After any site-specific attempt, check the target content and compare the current position with the value recorded before it:

Rank #4
Sale
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.
const after = await page.evaluate(() => window.scrollY);
console.log({ before, after, unchanged: before === after });

Check the actual output too—for an image, for example, verify that it has a usable source and that it loaded successfully. An unchanged scroll value alone does not prove the lazy content loaded.

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

When real visibility is required

If the site only loads content after a genuine visibility change, there is no source-backed universal method to trigger that change without moving the page. One option, when only the final position matters, is to scroll the target into view and then restore the original position. This changes the viewport during the operation, and restoring it does not guarantee that the site will retain the loaded content:

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
const originalY = await page.evaluate(() => window.scrollY);

await page.locator('img[data-src="/assets/photo.jpg"]').scrollIntoViewIfNeeded();
// Wait for the site's own loading condition; adapt this selector to the page.
await page.waitForFunction(() => {
  const img = document.querySelector('img[data-src="/assets/photo.jpg"]');
  return img && img.complete && img.naturalWidth > 0;
});

await page.evaluate(y => window.scrollTo(0, y), originalY);

Use a selector and completion condition that match the site. If the target is not an image, wait for the relevant element or application state instead. This approach preserves the final scroll position only if restoration succeeds; it does not meet a strict requirement that the page never move.

Avoid interactions that scroll targets into view

Puppeteer documents that hover() scrolls a target into view when needed, and its click API can also scroll a target into view. Do not use hover or click on an off-screen element if the viewport must remain fixed. See the Puppeteer Page API.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting

  • The callback wrapper logs nothing: the page may not use IntersectionObserver, may create observers in another context, or may have initialized them before instrumentation. Register the script before navigation and inspect the page’s implementation.
  • The callback runs but the image stays blank: a callback alone may not satisfy the site’s loading conditions. Check the target’s source attributes, the application’s code, console errors, and network requests.
  • The scroll position changed: check whether an interaction, focus change, or site script scrolled the page. Avoid off-screen click and hover actions; compare window.scrollY before and after each operation.
  • The image reports complete but is still unusable: confirm naturalWidth > 0 and inspect the resolved source. A failed image request can finish without producing a loaded image.
  • The content loads only after scrolling: that implementation depends on visibility or a related state. If the page must not move even temporarily, the available Puppeteer documentation does not establish a universal way around that dependency.

Or skip the browser setup

For a clean screenshot rather than a custom Puppeteer workflow, ScreenshotNeo can capture a URL through one API request. It accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. It also provides an MCP server with screenshot and PDF tools for AI agents. The free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

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

For example, with an API key, this cURL request saves a WebP capture of the target URL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo documentation for API details, then sign up for 1,000 free screenshots a month with no card.

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
$392.99
SaleBestseller 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.
$150.00
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

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

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.