Skip to main content
Glama
nayakprashant

Selenium MCP Server

click_element

Click a web page interactive element by its index, obtained from get_interactive_elements.

Instructions

Click an interactive element on the current webpage using its index.

Purpose

This tool allows the agent to click buttons, links, or other interactive UI elements on the page. The element must first be discovered using get_interactive_elements, which returns a list of visible elements and assigns each one an index.

The index returned by get_interactive_elements must be used with this tool to select the correct element.

  1. Navigate to the desired page using open_url.

  2. Wait for the page to load using wait_for_page.

  3. Call get_interactive_elements to discover clickable elements.

  4. Review the returned elements and identify the correct one.

  5. Call click_element using the element's index.

  6. If navigation occurs after clicking, call wait_for_page again.

Parameters

session_id : str Active browser session identifier returned by open_browser.

index : int Index of the element to click. This index must correspond to an element returned by get_interactive_elements.

Returns

dict { "session_id": str "index": index of the element that was clicked, "status": str "message": str }

Error Conditions

  • If get_interactive_elements has not been called yet, the element cache will be empty and the tool will return an error.

  • If the provided index does not exist in the cached elements list, the tool will return an "Invalid element index" error.

Notes

The tool automatically scrolls the element into view before clicking to ensure it is visible and interactable.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
indexYes
session_idYes
Behavior5/5

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

Describes auto-scroll behavior, element caching mechanism, and error handling (empty cache, invalid index). Since no annotations are provided, the description fully covers behavioral traits.

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?

Well-organized with sections (Purpose, Workflow, Parameters, Returns, Errors, Notes). Every sentence adds value without redundancy.

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?

Covers discovery requirement, return format as dict, error conditions, and auto-scroll. Despite no output schema, the description provides sufficient detail for correct invocation.

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?

With 0% schema description coverage, the description compensates by explaining session_id (from open_browser) and index (must match get_interactive_elements output), adding essential meaning beyond the 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 clearly states the tool clicks interactive elements using an index, distinguishing it from type_into_element and get_interactive_elements. It specifies it works with buttons, links, and other interactive UI elements.

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?

Provides a recommended 6-step workflow, explains prerequisite of calling get_interactive_elements, and lists error conditions. It implicitly contrasts with type_into_element for typing actions.

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/nayakprashant/selenium-mcp-server'

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