click
Automate web element interaction by clicking specified page elements using CSS selectors for browser automation and testing workflows.
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
- tools-playwright.js:73-87 (registration)Registration of the 'click' MCP tool, defining its name, description, input schema, and handler function that delegates to browser.click{ name: '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'] }, handler: async ({ selector }) => { await browser.click(selector); return { success: true, message: `Clicked element: ${selector}` }; } },
- tools-playwright.js:76-82 (schema)Input schema for the 'click' tool requiring a CSS selectorinputSchema: { type: 'object', properties: { selector: { type: 'string', description: 'CSS selector for the element to click' } }, required: ['selector'] },
- tools-playwright.js:83-86 (handler)The handler function for the 'click' tool, which performs the click action via the browser instance and returns a success messagehandler: async ({ selector }) => { await browser.click(selector); return { success: true, message: `Clicked element: ${selector}` }; }
- browser.js:84-87 (helper)Helper method in SimpleBrowser class that implements the actual click using Playwright's page.clickasync click(selector) { await this.ensureLaunched(); await this.page.click(selector); }
- index.js:74-76 (registration)Creation of the tools array (including 'click') that is used to register tools with the MCP server request handlers// Register all available automation tools const tools = createTools(browser);