Skip to main content
Glama

playwright_click

Click elements on web pages using CSS selectors to interact with or automate actions in a browser environment. Part of the Playwright MCP Server for web automation tasks.

Instructions

Click an element on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for the element to click

Implementation Reference

  • ClickTool class: core handler that executes page.click(selector) on the browser page.
    export class ClickTool extends BrowserToolBase { /** * Execute the click tool */ async execute(args: any, context: ToolContext): Promise<ToolResponse> { return this.safeExecute(context, async (page) => { await page.click(args.selector); return createSuccessResponse(`Clicked element: ${args.selector}`); }); } }
  • Tool schema definition including name, description, and input schema requiring 'selector'.
    name: "playwright_click", description: "Click an element on the page", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for the element to click" }, }, required: ["selector"], }, },
  • Dispatch/registration in main tool handler switch statement calling ClickTool.execute()
    case "playwright_click": return await clickTool.execute(args, context);
  • src/tools.ts:408-408 (registration)
    Tool name registered in BROWSER_TOOLS constant array used for conditional browser setup.
    "playwright_click",
  • Helper function in codegen generator that produces Playwright test code for click actions.
    private generateClickStep(parameters: Record<string, unknown>): string { const { selector } = parameters; return ` // Click element await page.click('${selector}');`; }

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/pvinis/mcp-playwright-stealth'

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