Skip to main content
Glama

browser_select_option

Select a specific option from dropdown elements in web browsers using element selectors and values to automate form interactions or UI testing.

Instructions

Select an option from a dropdown

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
instanceIdYesInstance ID
selectorYesElement selector
valueYesValue to select
timeoutNoTimeout in milliseconds

Implementation Reference

  • The main handler function that executes the browser_select_option tool by calling Playwright's page.selectOption method on the specified selector with the given value.
    private async selectOption(instanceId: string, selector: string, value: string, timeout: number): Promise<ToolResult> { const instance = this.browserManager.getInstance(instanceId); if (!instance) { return { success: false, error: `Instance ${instanceId} not found` }; } try { await instance.page.selectOption(selector, value, { timeout }); return { success: true, data: { selector, value, selected: true }, instanceId }; } catch (error) { return { success: false, error: `Select option failed: ${error instanceof Error ? error.message : error}`, instanceId }; } }
  • The input schema and metadata (name, description) for the browser_select_option tool, used for validation and MCP registration.
    name: 'browser_select_option', description: 'Select an option from a dropdown', inputSchema: { type: 'object', properties: { instanceId: { type: 'string', description: 'Instance ID' }, selector: { type: 'string', description: 'Element selector', }, value: { type: 'string', description: 'Value to select', }, timeout: { type: 'number', description: 'Timeout in milliseconds', default: 30000 } }, required: ['instanceId', 'selector', 'value'] }
  • src/tools.ts:550-552 (registration)
    The dispatch case in the executeTools method that routes calls to the selectOption handler.
    case 'browser_select_option': return await this.selectOption(args.instanceId, args.selector, args.value, args.timeout || 30000);

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/sailaoda/concurrent-browser-mcp'

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