Skip to main content
Glama

click

Click web elements by CSS, XPath, or text selector. Handle nth match, all visible matches, visibility conditions, or clicks scoped to a parent container.

Instructions

Click element(s) matching a CSS, XPath, or supported text selector.

Use this tool for normal clicks, clicking a specific matching occurrence, clicking all visible matches, conditional clicks, or clicks scoped to a parent element.

Selection behavior:

  • nth is 1-based and takes precedence over every other click mode.

  • Otherwise, all_matches=True clicks every currently visible match.

  • Otherwise, only_if_visible=True clicks only if a match is visible.

  • Otherwise, parent_selector scopes the click to a nested element.

  • With none of the above, performs a normal SeleniumBase click.

Args: selector: CSS selector, XPath selector, or supported SeleniumBase text-matching selector. Text-matching selectors such as a:contains("Sign in") are supported only for single-element clicks; do not use them with all_matches=True.

nth: 1-based occurrence to click when multiple elements match.
    Must be >= 1. Takes precedence over `all_matches`,
    `only_if_visible`, and `parent_selector`.

all_matches: If True, click every currently visible matching element
    in order of appearance. Ignored when `nth` is provided. Use only
    when multiple clicks are intentionally desired, such as for
    clicking all the checkboxes in a section of a webpage.
    If a click induces page navigation, then subsequent clicks are
    cancelled.

only_if_visible: If True, click only when the target is already
    visible; do not wait for it to become visible.

parent_selector: CSS/XPath selector for the parent/container in which
    to find `selector`. Used only for the nested-click mode.
    Can be used to click an element inside a parent iframe.

timeout: Maximum seconds to wait for a normal click operation.
    Default: 5. Not used by conditional or bulk click modes.

scroll: If True, scroll the target into view before a normal or
    indexed click. Default: True.

Examples: - Click one element: click("button.submit") - Click the 2nd matching element: click("button", nth=2) - Click all visible matches: click(".dismiss", all_matches=True) - Click only if already visible: click("#menu", only_if_visible=True) - Click inside a container: click(".item", parent_selector="#result")

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nthNo
scrollNo
timeoutNo
selectorYes
all_matchesNo
only_if_visibleNo
parent_selectorNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.3.0
    • changedInput schema / properties / timeout / default
      Previous value: -7New value: +5
  2. 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"
  3. 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"
      +  }
      +]
  4. Changed5 schema fields changedv1.2.0
    • addedInput schema / properties / all_matches
      Added value: +{
      +  "default": false,
      +  "title": "All Matches",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / nth
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Nth"
      +}
    • addedInput schema / properties / only_if_visible
      Added value: +{
      +  "default": false,
      +  "title": "Only If Visible",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / parent_selector
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Parent Selector"
      +}
    • changedInput schema / properties / timeout / default
      Previous value: -nullNew value: +7
  5. Changed3 schema fields changedv1.0.2
    • removedInput schema / properties / by
      Removed value: -{
      -  "default": "css",
      -  "title": "By",
      -  "type": "string"
      -}
    • addedInput schema / properties / scroll
      Added value: +{
      +  "default": true,
      +  "title": "Scroll",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / timeout
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "integer"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Timeout"
      +}
  6. First observedv0.1.1

TDQS

A4.8/5.0
Behavior5/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, and it delivers: it discloses selection precedence, visibility waiting behavior, navigation-cancellation side effects, timeout applicability, and scroll default. This goes well beyond a generic click description.

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?

Despite being long, the description is front-loaded with a one-line purpose, followed by a compact precedence list, detailed Args, and examples. No filler; the length is justified by the number of modes and caveats.

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

Completeness5/5

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

For a seven-parameter tool with no annotations, the description covers all invocation modes, edge cases, and defaults. The presence of an output schema means return-value details are not required; nothing needed to call this tool correctly is missing.

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 description coverage is 0%, but the Args section explains every parameter's meaning, default, constraints, and interactions, such as nth being 1-based, parent_selector enabling iframe scoping, and all_matches being ignored when nth is set. Examples map parameters to concrete calls.

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?

Opens with a specific verb and resource: 'Click element(s) matching a CSS, XPath, or supported text selector.' The enumerated click modes and examples make clear this is the click action, distinct from siblings like hover_action, type_text, or focus.

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

Usage Guidelines4/5

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

Gives explicit conditions for each click mode, including precedence order and a warning to use all_matches only when multiple clicks are intentionally desired. It does not explicitly contrast with sibling tools like hover_action, but the mode guidance is strong enough to select the correct invocation.

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