click-element
Simulate clicking on web page elements using CSS selectors to automate browser interactions within AdsPower profiles.
Instructions
Click the element
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | The selector of the element to click, find from the page source code |
Implementation Reference
- src/handlers/automation.ts:80-84 (handler)The core handler function for the 'click-element' tool. It checks if the browser is connected, clicks the element using the provided CSS selector on the current page, and returns a success message.async clickElement({ selector }: ClickElementParams) { browser.checkConnected(); await browser.pageInstance!.click(selector); return `Clicked element with selector: ${selector} successfully`; },
- src/types/schemas.ts:182-184 (schema)Zod schema for input validation of the 'click-element' tool, defining a required 'selector' string parameter.clickElementSchema: z.object({ selector: z.string().describe('The selector of the element to click, find from the page source code') }).strict(),
- src/utils/toolRegister.ts:68-69 (registration)Registers the 'click-element' tool with the MCP server, providing name, description, input schema, and wrapped handler function.server.tool('click-element', 'Click the element', schemas.clickElementSchema.shape, wrapHandler(automationHandlers.clickElement));