Use this file to discover all available pages before exploring further.
Repeatedly click a button until no new content appears or max clicks reached.This function is useful for “Load More” buttons or paginated content where you need to
keep clicking until all content is loaded. It provides several stopping conditions:
Button becomes invisible/disabled
Maximum number of clicks reached
No change detected in container content (when containerLocator is provided)
import { clickUntilExhausted } from "@intuned/browser";import { BrowserContext, Page } from "playwright";interface Params {}export default async function handler( params: Params, page: Page, context: BrowserContext) { await page.goto("https://sandbox.intuned.dev/load-more"); const loadMoreButton = page.locator("main main button"); // Select the main button in the main content area. // Click until button disappears or is disabled await clickUntilExhausted({ page, buttonLocator: loadMoreButton, maxClicks: 20, }); // Will keep clicking the button until the button disappears or is disabled or the maxClicks is reached.}