> ## Documentation Index
> Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# isPageLoaded

> [!TIP]
>
> This function uses AI and incurs costs.

Uses AI vision to determine if a webpage has finished loading by analyzing a screenshot.
Detects loading spinners, blank content, or incomplete page states.

```typescript theme={null}
export declare function isPageLoaded(input: {
  page: Page;
  timeoutInMs?: number;
  model?: string;
  apiKey?: string;
}): Promise<boolean>;
```

## Examples

```typescript Check Page Loading theme={null}
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);
  }
}
```

```typescript Loading Loop theme={null}
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++;
  }
}
```

## Arguments

**input** `Object` *required*

Input object containing the page to check

**properties**

**input.page** `Page` *required*

The Playwright page to check

**input.timeoutInMs** `number`

Screenshot timeout in milliseconds. Defaults to 10000

**input.model** `string`

AI model to use for the check. Accepts any vision-capable model supported by
Anthropic, OpenAI, or Google. Defaults to "gpt-5-mini-2025-08-07".

**input.apiKey** `string`

Optional API key for the AI call.

## Returns: `Promise<boolean>`

Promise resolving to true if page is loaded, false if still loading.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.