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];
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool waits for an element to be visible, but doesn't explain what happens after waiting (e.g., returns success/failure, throws an error on timeout, or proceeds silently). It also omits details like whether it's blocking, if it affects page state, or any performance implications. For a tool with no annotations, this is insufficient.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence: 'Wait for an element to be visible on the page'. It's front-loaded with the core action and resource, with zero wasted words. This makes it easy to parse and understand quickly, earning a high score for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of browser interaction tools, the description is incomplete. With no annotations and no output schema, it fails to explain behavioral aspects (e.g., what the tool returns or how errors are handled) or usage context. While the schema covers parameters well, the overall description lacks the depth needed for an agent to use this tool effectively in a scraping workflow.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with clear documentation for both parameters ('selector' and 'timeout'). The description doesn't add any extra meaning beyond the schema, such as examples of CSS selectors or advice on timeout values. Since the schema does the heavy lifting, a baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Wait for an element to be visible on the page'. It specifies the action ('wait for') and the resource ('an element'), making it understandable. However, it doesn't explicitly differentiate from sibling tools like 'scraping_browser_navigate' or 'scraping_browser_click', which are also browser interaction tools but serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., requiring a page to be loaded first), exclusions, or compare it to similar tools like 'scraping_browser_get_html' which might also involve waiting. This lack of context makes it harder for an agent to decide when this tool is appropriate.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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