playwright_click
Simulate user clicks on web page elements using CSS selectors for browser automation and testing.
Instructions
Click an element on the page
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for the element to click |
Implementation Reference
- src/tools/browser/interaction.ts:7-16 (handler)ClickTool class implements the core handler logic for 'playwright_click' tool by executing page.click on the specified selector.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}`); }); }
- src/tools.ts:113-123 (schema)Tool definition including name, description, and input schema for 'playwright_click'.{ 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"], }, },
- src/toolHandler.ts:484-485 (registration)Registration and dispatch of 'playwright_click' tool call to the ClickTool instance in the main tool handler switch statement.case "playwright_click": return await clickTool.execute(args, context);
- src/toolHandler.ts:321-321 (registration)Instantiation of the ClickTool instance used for handling 'playwright_click'.if (!clickTool) clickTool = new ClickTool(server);
- src/tools.ts:453-473 (helper)'playwright_click' listed in BROWSER_TOOLS array for conditional browser launching."playwright_click", "playwright_iframe_click", "playwright_iframe_fill", "playwright_fill", "playwright_select", "playwright_hover", "playwright_upload_file", "playwright_evaluate", "playwright_close", "playwright_expect_response", "playwright_assert_response", "playwright_custom_user_agent", "playwright_get_visible_text", "playwright_get_visible_html", "playwright_go_back", "playwright_go_forward", "playwright_drag", "playwright_press_key", "playwright_save_as_pdf", "playwright_click_and_switch_tab" ];