Skip to main content
Glama

browser_select

Select dropdown elements on web pages using CSS selectors to automate form interactions during penetration testing.

Instructions

Select an element on the page with Select tag using CSS selector

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
selectorYesCSS selector for element to select
valueYesValue to select

Implementation Reference

  • Executes the browser_select tool: selects an option in a select element using CSS selector and value, includes error handling for strict mode violations with retry on first matching element.
    case ToolName.BrowserSelect: try { await page.locator(args.selector).selectOption(args.value); return { content: [{ type: "text", text: `Selected ${args.selector} with: ${args.value}`, }], isError: false, }; } catch (error) { if((error as Error).message.includes("strict mode violation")) { console.log("Strict mode violation, retrying on first element..."); try { await page.locator(args.selector).first().selectOption(args.value); return { content: [{ type: "text", text: `Selected ${args.selector} with: ${args.value}`, }], isError: false, }; } catch (error) { return { content: [{ type: "text", text: `Failed (twice) to select ${args.selector}: ${(error as Error).message}`, }], isError: true, }; } } return { content: [{ type: "text", text: `Failed to select ${args.selector}: ${(error as Error).message}`, }], isError: true, }; }
  • Input schema and definition for the browser_select tool, requiring 'selector' (CSS selector) and 'value' (option value).
    { name: ToolName.BrowserSelect, description: "Select an element on the page with Select tag using CSS selector", inputSchema: { type: "object", properties: { selector: { type: "string", description: "CSS selector for element to select" }, value: { type: "string", description: "Value to select" }, }, required: ["selector", "value"], }, },
  • index.ts:840-842 (registration)
    Registers the list of available tools, including browser_select, by returning the static TOOLS array in response to ListToolsRequest.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS, }));
  • index.ts:844-846 (registration)
    Registers the CallToolRequest handler which dispatches tool calls (including browser_select) to the handleToolCall function based on the tool name.
    server.setRequestHandler(CallToolRequestSchema, async (request) => handleToolCall(request.params.name as ToolName, request.params.arguments ?? {}) );
  • index.ts:28-28 (registration)
    Defines the tool name constant BrowserSelect = "browser_select" in the ToolName enum.
    BrowserSelect = "browser_select",

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/9olidity/MCP-Server-Pentest'

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