Skip to main content
Automatically scrolls through infinite scroll content by repeatedly scrolling to the bottom until no new content loads or maximum scroll limit is reached.
export declare function scrollToLoadContent(input: {
  source: Page | Locator;
  onScrollProgress?: CallableFunction;
  maxScrolls?: number;
  delayInMs?: number;
  minHeightChange?: number;
}): Promise<void>;

Examples

import { scrollToLoadContent } from "@intuned/browser";
import { BrowserContext, Page } from "playwright";

interface Params {}

export default async function handler(
  params: Params,
  page: Page,
  context: BrowserContext
) {
  // Scroll through entire page content
  await page.goto("https://sandbox.intuned.dev/infinite-scroll");
  await scrollToLoadContent({
    source: page,
  });
  // Will keep scrolling until the page has loaded all content or the maxScrolls is reached.
}

Arguments

input
Object
required
The input object containing the data to scroll to load content.

Returns: Promise<void>

Promise that resolves when scrolling is complete.