Skip to main content
Glama

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
NameRequiredDescriptionDefault
selectorYesCSS selector for element to select
valueYesValue to select

Implementation Reference

  • 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}`); }); } }
  • 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"], }, },
  • 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);
  • 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}');`; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aakashH242/mcp-playwright'

If you have feedback or need assistance with the MCP directory API, please join our Discord server