Skip to main content
Glama

playwright_click

Automate clicks on web elements using CSS selectors with browser automation, enabling precise interaction with web pages for tasks like testing and scraping.

Instructions

Click an element on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for the element to click

Implementation Reference

  • ClickTool class: the main handler implementation for 'playwright_click' tool. Uses Playwright's page.click(selector) to execute the click.
    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"], }, },
  • Registration and dispatch: switch case in handleToolCall function that calls the ClickTool's execute method.
    case "playwright_click": return await clickTool.execute(args, context);
  • Instantiation of the ClickTool instance.
    if (!clickTool) clickTool = new ClickTool(server);
  • Listed in BROWSER_TOOLS array, used to conditionally launch browser for this tool.
    "playwright_click",

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/BhanuTJ93/MCP'

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