Skip to main content
export declare function waitForDomSettled(options: {
  source: Page | Locator;
  settleDurationMs?: number;
  timeoutInMs?: number;
}): Promise<boolean>;
Waits for the DOM to stop changing before proceeding. Useful for dynamic content that loads progressively or elements that appear/update after initial page load. This function monitors DOM mutations and waits for a specified duration of stability before considering the DOM “settled”. It can monitor either the entire page or a specific element within the page.

Examples

import { waitForDomSettled } from '@intuned/browser';
export default async function handler(params, page, context){
// Navigate to a dynamic page
await page.goto('https://docs.intunedhq.com/docs-old/getting-started/introduction');

// Wait for entire page content to stabilize
const settled = await waitForDomSettled({
  source: page,
  settleDurationMs: 1000
});

if (settled) {
  // Safe to scrape or interact with content
  console.log(`Found stable items`);
} else {
  console.log("DOM never fully settled, proceeding anyway");
}
}

Arguments

options
Object
required
Configuration object for DOM settlement monitoring

Returns: Promise<boolean>

Promise that resolves to true if DOM settled within timeout, false if timeout or error occurred