async def is_page_loaded(
page: Page,
*,
timeout_s: int = 10,
model: SUPPORTED_MODELS = 'gpt-4o-2024-08-06',
api_key: str | None = None,
) -> bool
Uses AI vision to determine if a webpage has finished loading by analyzing a screenshot.
Detects loading spinners, blank content, or incomplete page states.
Examples
from intuned_browser.ai import is_page_loaded
async def automation(page, params, **_kwargs):
# Wait for page to finish loading
await page.goto('https://example.com')
page_loaded = await is_page_loaded(page)
if page_loaded:
# Continue with scraping or interactions
print("Page is fully loaded")
else:
# Wait longer or retry
print("Page is still loading")
Arguments
The Playwright page to check
Screenshot timeout in seconds. Defaults to 10.
model
SUPPORTED_MODELS
default:"'gpt-4o-2024-08-06'"
AI model to use for the check. See SUPPORTED_MODELS for all supported models. Defaults to “gpt-4o-2024-08-06”.
Optional API key for the AI service (if provided, will not be billed to your account). Defaults to None.
Returns: bool
True if page is loaded, False if still loading