select
Automate dropdown selection in web testing by specifying a CSS selector and value to choose, enabling precise UI interaction for browser automation tasks.
Instructions
Select an option from a dropdown
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for the select element | |
| value | Yes | Value to select |
Implementation Reference
- index.js:750-774 (handler)Implements the 'select' tool by evaluating JavaScript in the browser to find the select element by CSS selector, set its value, dispatch a change event, and return success message or error if element not found.async select(selector, value) { await this.ensureChromium(); const result = await this.sendCDPCommand('Runtime.evaluate', { expression: ` const select = document.querySelector('${selector}'); if (select) { select.value = '${value}'; select.dispatchEvent(new Event('change', { bubbles: true })); true; } else { false; } `, returnByValue: true }); if (!result.result?.value) { throw new Error(`Select element not found: ${selector}`); } return { content: [{ type: 'text', text: `Selected '${value}' in ${selector}` }], }; }
- index.js:214-230 (schema)Schema definition for the 'select' tool, including name, description, and input schema requiring 'selector' and 'value' parameters.name: 'select', description: 'Select an option from a dropdown', inputSchema: { type: 'object', properties: { selector: { type: 'string', description: 'CSS selector for the select element', }, value: { type: 'string', description: 'Value to select', }, }, required: ['selector', 'value'], }, },
- index.js:366-367 (registration)Registration of the 'select' tool handler in the CallToolRequestSchema switch statement, dispatching to the select method with parsed arguments.return await this.select(args.selector, args.value); case 'get_console_logs':