Skip to main content
Glama

click

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

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

  • The core handler logic for the 'click' tool, implementing the click action using Puppeteer by waiting for the selector and calling 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}`);
        }
    }
  • Input schema definition for the 'click' tool, specifying the required '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:123-125 (registration)
    Registration and dispatching logic in the MCP CallToolRequestSchema handler, invoking browserManager.click for the 'click' tool.
    case "click":
        result = await browserManager.click(String(args?.selector));
        break;

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