Skip to main content
Glama

click

Simulate user clicks on web elements using CSS selectors for automated browser testing and interaction validation.

Instructions

Click an element on the page identified by a CSS selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector of the element to click

Implementation Reference

  • Core handler function that executes the click logic using Puppeteer: waits for the selector and performs page.click.
    async click(selector: string) { const page = await this.init(); try { await page.waitForSelector(selector, { timeout: 5000 }); await page.click(selector); return `Clicked element: ${selector}`; } catch (e: any) { throw new Error(`Failed to click ${selector}: ${e.message}`); } }
  • MCP tool call handler dispatch for 'click' tool, invoking browserManager.click.
    case "click": result = await browserManager.click(String(args?.selector)); break;
  • Input schema definition for the 'click' tool, specifying the 'selector' parameter.
    { name: "click", description: "Click an element on the page identified by a CSS selector", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector of the element to click" }, }, required: ["selector"], }, },
  • src/index.ts:106-110 (registration)
    Tool registration via ListToolsRequestHandler, which returns the TOOLS array including 'click'.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: 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/samusilv/qa-agent-mcp'

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