Skip to main content
Glama

playwright_select

Automate selecting values from dropdown elements on web pages using CSS selectors with this tool integrated into the MCP Browser Automation Server for precise and efficient task execution.

Instructions

Select an element on the page with Select tag

Input Schema

NameRequiredDescriptionDefault
selectorYesCSS selector for element to select
valueYesValue to select

Input Schema (JSON Schema)

{ "properties": { "selector": { "description": "CSS selector for element to select", "type": "string" }, "value": { "description": "Value to select", "type": "string" } }, "required": [ "selector", "value" ], "type": "object" }

Implementation Reference

  • Handler logic for the 'playwright_select' tool. Waits for the selector and selects the option with the given value using Playwright's selectOption method.
    case "playwright_select": try { await page!.waitForSelector(args.selector); await page!.selectOption(args.selector, args.value); return { toolResult: { content: [{ type: "text", text: `Selected ${args.selector} with: ${args.value}`, }], isError: false, }, }; } catch (error) { return { toolResult: { content: [{ type: "text", text: `Failed to select ${args.selector}: ${(error as Error).message}`, }], isError: true, }, }; }
  • Tool definition including name, description, and input schema for 'playwright_select'.
    { 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"], }, },
  • BROWSER_TOOLS array that includes 'playwright_select', used to determine if browser launch is required.
    export const BROWSER_TOOLS = [ "playwright_navigate", "playwright_screenshot", "playwright_click", "playwright_fill", "playwright_select", "playwright_hover", "playwright_evaluate" ];

Other Tools

Related Tools

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/hrmeetsingh/mcp-browser-automation'

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