Skip to main content
Glama

browser_wait_for_element

Wait for a specific element to appear on a webpage before proceeding with automated browser tasks, ensuring reliable interaction with dynamic content.

Instructions

Wait for an element to appear

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceIdYesInstance ID
selectorYesElement selector
timeoutNoTimeout in milliseconds

Implementation Reference

  • Core handler function that executes the tool logic: retrieves browser instance and calls Playwright's page.waitForSelector with the given selector and timeout.
    private async waitForElement(instanceId: string, selector: 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.waitForSelector(selector, { timeout }); return { success: true, data: { selector, found: true }, instanceId }; } catch (error) { return { success: false, error: `Wait for element failed: ${error instanceof Error ? error.message : error}`, instanceId }; } }
  • src/tools.ts:569-570 (registration)
    Switch statement case in executeTools method that dispatches to the waitForElement handler.
    case 'browser_wait_for_element': return await this.waitForElement(args.instanceId, args.selector, args.timeout || 30000);
  • Tool registration in getTools() array, including name, description, and inputSchema for validation.
    name: 'browser_wait_for_element', description: 'Wait for an element to appear', inputSchema: { type: 'object', properties: { instanceId: { type: 'string', description: 'Instance ID' }, selector: { type: 'string', description: 'Element selector', }, timeout: { type: 'number', description: 'Timeout in milliseconds', default: 30000 } }, required: ['instanceId', 'selector'] } },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sailaoda/concurrent-browser-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server