playwright_select
Select options from dropdown menus on web pages using CSS selectors and specified values for browser automation tasks.
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:114-125 (handler)The SelectTool.execute method implements the core logic of the 'playwright_select' tool, waiting for the selector and calling page.selectOption.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:171-182 (schema)The input schema definition for the 'playwright_select' tool, defining 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:597-598 (registration)Registration and dispatch of the 'playwright_select' tool in the main tool handler switch statement, calling the SelectTool's execute method.case "playwright_select": return await selectTool.execute(args, context);
- src/toolHandler.ts:396-396 (registration)Instantiation of the SelectTool instance used for handling 'playwright_select' tool calls.if (!selectTool) selectTool = new SelectTool(server);
- Code generation helper method that produces Playwright test code for the 'playwright_select' tool action.private generateSelectStep(parameters: Record<string, unknown>): string { const { selector, value } = parameters; return ` // Select option await page.selectOption('${selector}', '${value}');`; }