Skip to main content
Glama

browser_select_checkbox

Select checkboxes in web browsers using Selenium WebDriver. Specify element locator strategy and value to automate checkbox interactions for testing and automation workflows.

Instructions

Select a checkbox

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
byYesLocator strategy to find element
valueYesValue for the locator strategy
timeoutNoMaximum time to wait for element in milliseconds

Implementation Reference

  • MCP tool registration for 'browser_select_checkbox' including inline handler that delegates to ActionService.selectCheckbox
    server.tool('browser_select_checkbox', 'Select a checkbox', { ...locatorSchema }, async ({ by, value }) => { try { const driver = stateManager.getDriver(); const actionService = new ActionService(driver); await actionService.selectCheckbox({ by, value }); return { content: [{ type: 'text', text: `Selected checkbox` }], }; } catch (e) { return { content: [ { type: 'text', text: `Error selecting checkbox: ${(e as Error).message}`, }, ], }; } });
  • Core implementation logic: locates the checkbox element and clicks it if not already selected
    async selectCheckbox(params: LocatorParams): Promise<void> { const locator = LocatorFactory.createLocator(params.by, params.value); const checkbox = await this.driver.wait(until.elementLocated(locator), params.timeout || 15000); if (!(await checkbox.isSelected())) { await checkbox.click(); } }
  • Zod schema defining input parameters (locator strategy, value, optional timeout) for the tool
    export const locatorSchema = { by: z .enum(['id', 'css', 'xpath', 'name', 'tag', 'class', 'link', 'partialLink']) .describe('Locator strategy to find element'), value: z.string().describe('Value for the locator strategy'), timeout: z.number().optional().describe('Maximum time to wait for element in milliseconds'), };
  • Top-level tool registration function that invokes registerActionTools, including browser_select_checkbox
    export function registerAllTools(server: McpServer, stateManager: StateManager): void { registerBrowserTools(server, stateManager); registerElementTools(server, stateManager); registerActionTools(server, stateManager); registerCookieTools(server, stateManager); }

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/pshivapr/selenium-mcp'

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