playwright_select
Select specific options from dropdown menus on web pages using CSS selectors and values to automate form interactions and data entry.
Instructions
Select an element on the page with Select tag
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for element to select | |
| value | Yes | Value to select |
Implementation Reference
- src/tools/browser/interaction.ts:107-118 (handler)The SelectTool class implements the execution handler for the 'playwright_select' tool. It waits for the selector, selects the specified option using Playwright's selectOption method, and returns a success response.export class SelectTool extends BrowserToolBase { /** * Execute the select tool */ async execute(args: any, context: ToolContext): Promise<ToolResponse> { return this.safeExecute(context, async (page) => { await page.waitForSelector(args.selector); await page.selectOption(args.selector, args.value); return createSuccessResponse(`Selected ${args.selector} with: ${args.value}`); }); } }
- src/tools.ts:161-172 (schema)The input schema definition for the 'playwright_select' tool, specifying the required 'selector' and 'value' parameters.{ name: "playwright_select", description: "Select an element on the page with Select tag", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to select" }, value: { type: "string", description: "Value to select" }, }, required: ["selector", "value"], }, },
- src/toolHandler.ts:496-497 (registration)Dispatch/registration of the 'playwright_select' tool handler in the main tool call switch statement, routing to selectTool.execute.case "playwright_select": return await selectTool.execute(args, context);
- src/toolHandler.ts:325-325 (registration)Instantiation of the SelectTool instance in the initializeTools function, which is called before handling tool calls.if (!selectTool) selectTool = new SelectTool(server);
- src/tools/codegen/generator.ts:81-82 (helper)Helper case in codegen generator for handling 'playwright_select' actions when generating Playwright test code.case 'playwright_select': return this.generateSelectStep(parameters);