DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk8 min

How to Capture Every Item on an Infinite Scroll Page with Playwright

A practical Playwright pattern for capturing infinite-scroll records incrementally, handling nested and virtualized lists, and avoiding premature completion.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To collect items from an infinite-scroll page, repeatedly scroll the element that actually owns the scrolling, wait for the page’s loading or completion signal, and extract each newly rendered batch. Merge results by a stable item ID or URL, then stop only when the page indicates there is no more content—or clearly label a bounded no-progress stop as uncertain. Playwright provides the scrolling and locator tools; the site must provide the signal that tells you when loading is complete.

What “every item” means on an infinite-scroll page

This method captures matching items the page renders for your current session, filters, permissions, and access rights. It cannot collect records the application never renders, content hidden behind a login, or items excluded by the current view. Some pages recycle rows as you scroll; in that case, a final DOM snapshot will omit earlier rows, so collect and retain each batch as you go.

As an Amazon Associate I earn from qualifying purchases.

Before automating, identify the repeated item element, a stable key such as a record URL or site-provided ID, and the actual scroll owner. The list may scroll with the document or inside a nested panel.

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

Choose the scrolling method

Playwright’s scrolling guide explicitly recognizes manually scrolling to force an infinite list to load more elements. It documents bringing an element into view with scrollIntoViewIfNeeded(), sending wheel input with mouse.wheel(), and changing a particular container’s scrollTop through locator.evaluate(). See Playwright’s scrolling guide.

#1 Best Overall
Sale
Logitech Brio 101 Full HD 1080p Webcam for Streaming and Meetings - Black | 1080p with auto-light correction, built-in mic, privacy shutter, USB-A, compatible with Teams, Google Meet, Zoom and more
  • 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
Method Use it when Trade-off
scrollIntoViewIfNeeded() on a bottom sentinel or known element The page has a useful element near the end of the list. It brings an element into view; it is not itself a completion signal.
mouse.wheel() You want to trigger behavior tied to user-like wheel input, especially in a nested panel. For a nested scroller, hover the container first so the wheel event targets it.
Set a container’s scrollTop with locator.evaluate() You know which element scrolls and want precise control over its position. Directly changes the DOM scroll position rather than simulating wheel input.

There is no universally best method: choose the target and technique that match the page’s behavior. The examples below use a nested container and direct scrolling; adapt the selectors and completion condition to the site you are automating.

Build a bounded collector

This JavaScript example uses Playwright’s test-runner API. Replace the URL and selectors with those for the target page. It accumulates each rendered batch in a map keyed by a stable identity, which prevents duplicate records and preserves rows from virtualized lists.

import { test, expect } from '@playwright/test';

test('collect rendered records as the list loads', async ({ page }) => {
  await page.goto('https://example.com/records');

  const scroller = page.locator('[data-testid="results-scroll"]');
  const items = page.locator('[data-testid="record"]');
  const endMarker = page.locator('[data-testid="end-of-results"]');
  const loading = page.locator('[data-testid="loading-results"]');

  // Wait for the initial batch to be present.
  await expect(items.first()).toBeVisible();

  const records = new Map();
  const collectRendered = async () => {
    const batch = await items.evaluateAll(nodes => nodes.map(node => {
      const link = node.querySelector('a[href]');
      return {
        id: node.getAttribute('data-record-id') || link?.href,
        text: node.textContent?.trim() || '',
        url: link?.href || null
      };
    }));

    for (const record of batch) {
      if (record.id) records.set(record.id, record);
    }
    return batch.length;
  };

  await collectRendered();

  const maxNoProgress = 3;
  let noProgress = 0;

  while (!(await endMarker.isVisible().catch(() => false))) {
    const before = records.size;
    const metrics = await scroller.evaluate(el => ({
      top: el.scrollTop,
      height: el.scrollHeight,
      client: el.clientHeight
    }));

    await scroller.evaluate(el => {
      el.scrollTop = el.scrollHeight;
    });

    // Prefer the site's actual loading state over a fixed sleep.
    await loading.waitFor({ state: 'hidden', timeout: 10_000 }).catch(() => {});
    await collectRendered();

    const afterMetrics = await scroller.evaluate(el => ({
      top: el.scrollTop,
      height: el.scrollHeight,
      client: el.clientHeight
    }));

    const movedOrExpanded = afterMetrics.top !== metrics.top ||
      afterMetrics.height > metrics.height;
    const addedRecords = records.size > before;

    if (addedRecords || movedOrExpanded) {
      noProgress = 0;
    } else {
      noProgress += 1;
      if (noProgress >= maxNoProgress) {
        throw new Error(
          'No progress after bounded scroll attempts; completion is not confirmed.'
        );
      }
    }
  }

  await collectRendered();
  const result = [...records.values()];
  console.log(`Collected ${result.length} unique rendered records`);
  // Save or return result as needed.
});

The selector names, record ID attribute, loading indicator, and end marker here are examples, not universal Playwright selectors. If the site has no explicit end marker, replace that condition with a documented application signal such as an exhausted cursor or a known total count. The example deliberately throws when bounded attempts show no progress rather than silently claiming that a partial collection is complete.

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.
Rank #2
Sale
Logitech C270 720p Webcam Plug-and-Play Wide Screen Video Calling - Black | Auto-Light Correct, Noise-Reducing Mic, Zoom, Microsoft, Teams, Skype, Nintendo Switch 2 New GameChat Mode, PC Mac compatible
  • 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.

Adapt the sample to a document-scrolling page

If the document itself scrolls, use a bottom sentinel or a known footer as the trigger instead of the nested scroller. For example, locate the sentinel and call scrollIntoViewIfNeeded() before waiting for the next batch. Keep the same incremental collection and completion logic.

Use wheel input for a nested panel

When the interface reacts specifically to wheel events, hover the nested container and use page.mouse.wheel(0, distance) to advance it. The Playwright scrolling guide demonstrates hovering a specific container before sending a wheel event. Continue to wait for the site’s state change and extract after each load.

Wait for a real completion signal

Locators auto-wait for many actions, but they do not know that an application’s future list is complete. In particular, locator.all() immediately returns locators for elements present at that moment; it does not wait for future items. Playwright warns that taking this snapshot while a list is changing can produce unpredictable results. locator.evaluateAll() is useful for reading all matching elements currently rendered, so call it after each meaningful load. See the Locator API reference and Playwright locators guide.

Rank #3
Sale
NexiGo N60 1080P Webcam with Microphone, Software Control & Privacy Cover, USB HD Computer Web Camera, Plug and Play, for Zoom/Skype/Teams, Conferencing and Video Calling
  • 【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.
Completion signal How to use it Reliability note
End marker or exhausted cursor Stop when the site exposes an explicit terminal element or its data state says there are no more results. Strongest when it genuinely represents exhaustion, rather than merely being visible near the bottom.
Loading indicator plus count increase Wait for loading to finish, then confirm the rendered count or accumulated unique-key count increased. Useful when the application exposes both states; a disappearing spinner alone may also reflect a failed request.
Repeated no-progress attempts Track whether items, scroll position, or scroll height change; stop or raise a diagnostic error after a deliberate bound. Fallback only. Slow loading, wrong scroll target, or a request failure can look like completion.
Fixed delay Use only when the page offers no observable state to wait for. Less reliable: short delays can miss slow responses, while long delays waste time.

A quick lack of change is not proof that the list is finished. Distinguish an observed end condition from a timeout or network failure, and record which condition ended the run.

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

Selectors, duplicates, and virtualized rows

Use a stable, unique key to merge records across passes. A site-provided ID is usually preferable; a canonical record URL can work when IDs are unavailable. If no stable key exists, you can derive one from fields that uniquely identify a record, but test for collisions before trusting the output.

Prefer role- or text-based locators when they describe the item reliably. Use a site-specific CSS selector or test ID when the page has no suitable accessible contract. Playwright cautions that structural CSS and XPath selectors can break when the DOM structure changes; see its locator guidance.

Rank #4
Sale
EMEET C960 1080P Webcam with Microphone, 2 Mics, 90° FOV, Computer Camera | USB Type-A & A-to-C Adapter, Fixed Focus, Plug&Play for Zoom/Teams/Facetime/YouTube/Google Meet/Switch 2 Camera, 2025 Version
  • 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)

For a virtualized list, the DOM contains only a moving window of rows. Never wait until the end and then extract once: earlier rows may already have been removed. Extract each rendered batch during traversal and keep it outside the page, deduplicated by key.

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

Troubleshooting

  • Scrolling does not load more items: You may be scrolling the document while a nested panel owns the scroll, or vice versa. Compare the suspected container’s scrollTop and scrollHeight before and after a scroll, then target the element that actually changes. Check whether a loading request failed before treating no movement as the end.
  • The result contains only the first batch: A one-time call to locator.all() or evaluateAll() reads the current DOM, not future content. Wait for the page’s load transition and collect again on each pass.
  • The run stops too soon: Do not use one unchanged pass as a terminal condition. Wait for the site’s state, allow for slow responses, and use a bounded retry policy that reports uncertainty if progress never resumes.
  • Earlier rows are missing: The page may virtualize or recycle its DOM nodes. Accumulate data on every pass instead of taking a final snapshot.
  • Rows appear more than once: Merge on a stable unique ID or URL rather than appending every pass blindly.
  • The script waits forever: Put timeouts and a maximum number of consecutive no-progress attempts around waits and scrolling. Report whether the run ended at an end marker, a timeout, or a retry bound.
  • Selectors stop matching: Re-check the page’s accessible roles and current DOM. Prefer a stable role, label, or test ID over a long selector tied to layout structure.

Reliability, performance, and access limits

Collecting after each load uses more individual extraction passes than a final snapshot, but it is necessary when old rows disappear from the DOM. Keep the per-pass data small, deduplicate as you go, and avoid rescanning or storing unnecessary page markup. A site’s own completion or cursor signal is more useful than an arbitrary delay; neither a quiet network nor a visible bottom alone proves that every eligible record has been retrieved.

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

Respect the site’s terms, access controls, and rate limits. This approach does not authorize bypassing a login or other technical restriction. For exact method signatures, check the documentation matching your installed Playwright version: the cited scrolling and locator API pages use the /next documentation path, while the general locator and Page API references are at stable paths. The Page API reference documents page-level APIs.

Best Value
Logitech C920x HD Pro PC Webcam Full 1080p/30fps Video - Black | 30fps Video, Clear Audio, Light Correction, Works with Teams, Meet, Zoom, Nintendo Switch 2, Mac, Tablet
  • 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

Or skip the browser setup

For a screenshot rather than a structured collection of every record, ScreenshotNeo is a website screenshot API with a one-request capture. It is not a substitute for extracting and storing each item from an infinite list.

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 parameters. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

How do I scroll to load more items in Playwright?

Scroll the element that owns the list: bring a bottom sentinel into view, send wheel input to a hovered nested container, or adjust that container’s scrollTop. Then wait for the site’s loading or completion signal before collecting the next batch.

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

Does Playwright have a built-in signal that every infinite-scroll item has loaded?

No. The page’s application must expose a meaningful end condition, such as an end marker, exhausted cursor, or verified total count. A lack of new rows by itself does not establish completion.

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

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.