Uses AI vision to determine if a webpage has finished loading by analyzing a screenshot.
Detects loading spinners, blank content, or incomplete page states.
import { isPageLoaded } from "@intuned/browser/ai";import { BrowserContext, Page } from "playwright";interface Params {}export default async function handler( params: Params, page: Page, context: BrowserContext) { // Wait for page to finish loading await page.goto("https://sandbox.intuned.dev/"); const pageLoaded = await isPageLoaded({ page }); if (pageLoaded) { // Continue with scraping or interactions console.log("Page is loaded"); } else { // Wait longer or retry await page.waitForTimeout(5000); }}
import { isPageLoaded } from "@intuned/browser/ai";import { BrowserContext, Page } from "playwright";interface Params {}export default async function handler( params: Params, page: Page, context: BrowserContext) { // Keep checking until page loads await page.goto("https://example.com"); let attempts = 0; while (attempts < 10) { // We will retry up to 10 times with a 2-second delay between attempts. const pageLoaded = await isPageLoaded({ page, model: "claude-sonnet-4-5", timeoutInMs: 5000, }); if (pageLoaded) break; // If the page is loaded, break the loop. await page.waitForTimeout(2000); // Wait for 2 seconds before the next attempt. attempts++; }}