select-option
Select specific dropdown options in browser automation by providing CSS selectors and values to interact with web page elements programmatically.
Instructions
Select the option
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | The selector of the option to select, find from the page source code | |
| value | Yes | The value of the option to select |
Implementation Reference
- src/handlers/automation.ts:100-104 (handler)The handler function that executes the logic for the 'select-option' tool: waits for the selector, selects the option by value using Puppeteer page.selectOption, and returns a success message.async selectOption({ selector, value }: SelectOptionParams) { browser.checkConnected(); await browser.pageInstance!.waitForSelector(selector); await browser.pageInstance!.selectOption(selector, value); return `Selected option with selector: ${selector} with value: ${value} successfully`;
- src/types/schemas.ts:191-194 (schema)Zod schema defining the input parameters (selector and value) for the 'select-option' tool.selectOptionSchema: z.object({ selector: z.string().describe('The selector of the option to select, find from the page source code'), value: z.string().describe('The value of the option to select') }).strict(),
- src/utils/toolRegister.ts:74-75 (registration)Registration of the 'select-option' tool on the MCP server, linking the schema and wrapped handler.server.tool('select-option', 'Select the option', schemas.selectOptionSchema.shape, wrapHandler(automationHandlers.selectOption));