scraping_browser_wait_for
Wait for a specific element to become visible on a webpage during web scraping or browser automation, using CSS selectors with configurable timeout options.
Instructions
Wait for an element to be visible on the page
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"selector": "<selector>"
},
"name": "scraping_browser_wait_for"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector to wait for | |
| timeout | No | Maximum time to wait in milliseconds (default: 30000) |
Implementation Reference
- browser_tools.js:185-193 (handler)The execute function implementing the tool logic: retrieves the current browser page and waits for the specified CSS selector to be visible using page.waitForSelector with an optional timeout.
execute: async({selector, timeout})=>{ const page = await (await require_browser()).get_page(); try { await page.waitForSelector(selector, {timeout: timeout||30000}); return `Successfully waited for element: ${selector}`; } catch(e){ throw new UserError(`Error waiting for element ${selector}: ${e}`); } }, - browser_tools.js:180-184 (schema)Zod schema for input parameters: 'selector' (string, CSS selector) and optional 'timeout' (number, milliseconds).
parameters: z.object({ selector: z.string().describe('CSS selector to wait for'), timeout: z.number().optional() .describe('Maximum time to wait in milliseconds (default: 30000)'), }), - browser_tools.js:307-320 (registration)The tool is registered in the exported 'tools' array, conditionally if API_TOKEN is set.
export const tools = process.env.API_TOKEN ? [ scraping_browser_navigate, scraping_browser_go_back, scraping_browser_go_forward, scraping_browser_links, scraping_browser_click, scraping_browser_type, scraping_browser_wait_for, scraping_browser_screenshot, scraping_browser_get_text, scraping_browser_get_html, scraping_browser_scroll, scraping_browser_scroll_to, ] : [scraping_browser_activation_instructions];