click
Simulate precise clicks on specific web elements in Firefox using Playwright. Define elements by selector or coordinates, and control actions across multiple tabs for browser automation and debugging tasks.
Instructions
Click on an element
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| coordinates | No | ||
| selector | No | ||
| tabId | No |
Implementation Reference
- index-multi-debug.js:1050-1068 (handler)The core handler function for the 'click' tool that executes Playwright page.click either on a selector or at specific coordinates in the specified tab.async click(args) { this.ensureBrowserRunning(); const { selector, coordinates, tabId } = args; const page = this.getPage(tabId); if (coordinates) { await page.click(`body`, { position: coordinates }); return { content: [{ type: 'text', text: `Clicked at coordinates (${coordinates.x}, ${coordinates.y}) in tab '${tabId || this.activeTabId}'` }] }; } else if (selector) { await page.click(selector); return { content: [{ type: 'text', text: `Clicked element '${selector}' in tab '${tabId || this.activeTabId}'` }] }; } else { throw new Error('Either selector or coordinates must be provided'); } }
- index-multi-debug.js:409-410 (registration)Registration of the 'click' tool in the CallToolRequestSchema switch statement, dispatching to the click handler.case 'click': return await this.click(args);
- index-multi-debug.js:98-112 (schema)Tool definition in ListToolsRequestSchema including name, description, and input schema for the 'click' tool.{ name: 'click', description: 'Click on an element', inputSchema: { type: 'object', properties: { selector: { type: 'string' }, coordinates: { type: 'object', properties: { x: { type: 'number' }, y: { type: 'number' } } }, tabId: { type: 'string' } } } },