Skip to main content
Glama

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

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector to wait for
timeoutNoMaximum time to wait in milliseconds (default: 30000)

Implementation Reference

  • 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}`); } },
  • 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)'), }),
  • 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];

Other Tools

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/dsouza-anush/brightdata-mcp-heroku'

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