For AI agents: a documentation index is available at /llms.txt
Skip to main content

Wait for navigation after a click

Clicking a link or button that triggers a page load requires Promise.all to guarantee the navigation wait is registered before the click fires. This pattern is essential for reliable session management with remote browsers.

Prerequisites

Steps​

Use the Browserless MCP server to wait for navigation after a click from any MCP-compatible AI agent (Claude Desktop, Cursor, Windsurf, ChatGPT, etc.).

1. Connect the MCP server

Send this prompt to your AI agent to install the Browserless MCP server:

Go to https://github.com/browserless/browserless-mcp/blob/main/install.md
and follow the instructions to install the Browserless MCP server
for my client.

2. Navigate after a click

Use browserless_agent. The task requires interaction: clicking an element and waiting for the page to load.

Use the browserless_agent tool to go to
https://scraping-sandbox.netlify.app/products,
click the "Contact Us" link, wait for the new page to load,
then scrape the content
Was this page helpful?