Skip to main content
Glama

wait_for

Wait until an element or text becomes present, visible, not visible, or absent, then continue with the next automation step.

Instructions

Wait until an element or text reaches a requested state.

When text is provided, a state of 'present' or 'visible' both wait for the text to appear within the selector, and a state of 'not_visible' or 'absent' both wait for the text to be absent from the selector.

Use this tool when the page is dynamic and an automation step must wait for a condition before continuing.

Unlike check_condition, this tool intentionally waits. Unlike assert_condition, its purpose is synchronization rather than validating a test expectation.

Args: state: - "present": Wait until the matching element exists. - "visible": Wait until the matching element is visible. - "not_visible": Wait until the matching element is not visible. - "absent": Wait until the matching element no longer exists. (This is handled differently when text is provided.) selector: CSS selector or SeleniumBase selector for the element. Required unless text is supplied. text: If supplied and is not None, a state of 'present' or 'visible' both wait for the text to appear within the selector, and a state of 'not_visible' or 'absent' both wait for the text to be absent from the selector (or within "body" when selector is omitted). timeout: Maximum seconds to wait for the requested state to be true. (Defaults to 7 seconds.)

Returns: A confirmation when the requested condition is reached.

Tool selection: - Check current state immediately -> use check_condition. - Wait for a state/content transition -> use wait_for. - Verify an expected value/condition -> use assert_condition.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textNo
stateNovisible
timeoutNo
selectorNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Changed2 schema fields changedv1.2.5
    • removedInput schema / properties / timeout / anyOf
      Removed value: -[
      -  {
      -    "type": "integer"
      -  },
      -  {
      -    "type": "number"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • addedInput schema / properties / timeout / type
      Added value: +"number"
  2. Changed1 schema field changedv1.2.1
    • changedInput schema / properties / timeout / anyOf
      Previous value: -[
      -  {
      -    "type": "integer"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]New value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "number"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
  3. Addedv1.2.0

TDQS

A4.6/5.0
Behavior4/5

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

With no annotations, the description carries the behavioral disclosure burden. It clearly states that this tool intentionally waits and is for synchronization rather than validation, and it explains the timeout parameter and text/state interactions. It does not explicitly describe what happens on timeout, but the intentional-wait behavior is well conveyed.

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

Conciseness4/5

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

The description is organized into clear sections and front-loads the core purpose. However, the text/selector relationship is repeated in the opening paragraph and again in the Args section, and the formatting is somewhat verbose. Still, the structure aids readability.

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

Completeness4/5

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

The description covers purpose, usage context, parameter semantics, returns, and alternatives, which is strong for a tool with no annotations. Minor gaps remain: it does not state failure behavior on timeout, and there is some ambiguity about how text works when selector is omitted despite selector being described as 'required unless text is supplied.'

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

Parameters5/5

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

Schema coverage is 0%, so the description must fully explain parameters. It does: each state value is defined, selector and text are described with their relationship, and timeout has a default. This goes well beyond the bare schema.

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

Purpose5/5

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

The description opens with a specific action and target: 'Wait until an element or text reaches a requested state.' It explicitly contrasts itself with check_condition and assert_condition, so an agent can distinguish it from siblings without inspecting their schemas.

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

Usage Guidelines5/5

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

It gives direct usage context: use when the page is dynamic and an automation step must wait. The 'Tool selection' list explicitly states when to use check_condition, wait_for, or assert_condition, making decision-making straightforward.

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

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/seleniumbase/seleniumbase-mcp'

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