browser_wait_for_navigation
Wait for page navigation to complete in a concurrent browser instance, ensuring scripts and resources load before proceeding with automated tasks.
Instructions
Wait for page navigation to complete
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| instanceId | Yes | Instance ID | |
| timeout | No | Timeout in milliseconds |
Implementation Reference
- src/tools.ts:957-977 (handler)The main handler function that executes the browser_wait_for_navigation tool logic. It retrieves the browser instance, waits for navigation using Playwright's waitForNavigation method with the given timeout, and returns success or error status with current URL.private async waitForNavigation(instanceId: string, timeout: number): Promise<ToolResult> { const instance = this.browserManager.getInstance(instanceId); if (!instance) { return { success: false, error: `Instance ${instanceId} not found` }; } try { await instance.page.waitForNavigation({ timeout }); return { success: true, data: { url: instance.page.url() }, instanceId }; } catch (error) { return { success: false, error: `Wait for navigation failed: ${error instanceof Error ? error.message : error}`, instanceId }; } }
- src/tools.ts:420-438 (registration)Registers the 'browser_wait_for_navigation' tool in the getTools() method, including its name, description, and input schema definition.{ name: 'browser_wait_for_navigation', description: 'Wait for page navigation to complete', inputSchema: { type: 'object', properties: { instanceId: { type: 'string', description: 'Instance ID' }, timeout: { type: 'number', description: 'Timeout in milliseconds', default: 30000 } }, required: ['instanceId'] } },
- src/tools.ts:423-437 (schema)Defines the input schema for the tool, specifying required instanceId and optional timeout.inputSchema: { type: 'object', properties: { instanceId: { type: 'string', description: 'Instance ID' }, timeout: { type: 'number', description: 'Timeout in milliseconds', default: 30000 } }, required: ['instanceId'] }
- src/tools.ts:572-573 (registration)The switch case in executeTools() that handles the tool name and calls the corresponding handler method.case 'browser_wait_for_navigation': return await this.waitForNavigation(args.instanceId, args.timeout || 30000);