Skip to main content
Glama

playwright_click

Click webpage elements using CSS selectors for browser automation tasks with Playwright and Chrome DevTools Protocol.

Instructions

Click an element on the page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for element to click

Implementation Reference

  • The handler case for 'playwright_click' in the main tool handling switch statement. It uses Playwright's page.click to click the specified selector and returns success or error message.
    case "playwright_click": try { await page!.click(args.selector); return { content: [{ type: "text", text: `Clicked: ${args.selector}`, }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: `Failed to click ${args.selector}: ${(error as Error).message}`, }], isError: true, }; }
  • The tool definition including name, description, and input schema for 'playwright_click' in the createToolDefinitions function.
    { name: "playwright_click", description: "Click an element on the page", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to click" }, }, required: ["selector"], }, },
  • src/tools.ts:156-164 (registration)
    'playwright_click' is registered in the BROWSER_TOOLS array, used to conditionally launch the browser before handling browser-interacting tools.
    export const BROWSER_TOOLS = [ "playwright_navigate", "playwright_screenshot", "playwright_click", "playwright_fill", "playwright_select", "playwright_hover", "playwright_evaluate" ];

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/lars-hagen/mcp-playwright-cdp'

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