iframe-click-element
Click elements within iframes using specific selectors to interact with embedded content during browser automation tasks.
Instructions
Click the element in the iframe
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| iframeSelector | Yes | The selector of the iframe to click, find from the page source code | |
| selector | Yes | The selector of the element to click, find from the page source code |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"iframeSelector": {
"description": "The selector of the iframe to click, find from the page source code",
"type": "string"
},
"selector": {
"description": "The selector of the element to click, find from the page source code",
"type": "string"
}
},
"required": [
"selector",
"iframeSelector"
],
"type": "object"
}
Implementation Reference
- src/handlers/automation.ts:85-93 (handler)The core handler function that executes the iframe-click-element tool logic using Playwright's frameLocator to click an element inside a specified iframe.async iframeClickElement({ selector, iframeSelector }: IframeClickElementParams) { const frame = browser.pageInstance!.frameLocator(iframeSelector); if (!frame) { return `Iframe not found: ${iframeSelector}`; } await frame.locator(selector).click(); return `Clicked element ${selector} inside iframe ${iframeSelector} successfully`; },
- src/types/schemas.ts:218-221 (schema)Zod schema defining the input parameters (selector and iframeSelector) for the iframe-click-element tool.iframeClickElementSchema: z.object({ selector: z.string().describe('The selector of the element to click, find from the page source code'), iframeSelector: z.string().describe('The selector of the iframe to click, find from the page source code') }).strict(),
- src/utils/toolRegister.ts:92-93 (registration)Tool registration call that associates the name 'iframe-click-element' with its description, schema, and wrapped handler function.server.tool('iframe-click-element', 'Click the element in the iframe', schemas.iframeClickElementSchema.shape, wrapHandler(automationHandlers.iframeClickElement));