Skip to main content
Glama

browser_select_checkbox

Select checkboxes on web pages using various locator strategies to automate form interactions and UI testing.

Instructions

Select a checkbox

Input Schema

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

Implementation Reference

  • MCP tool registration with inline handler function that executes the tool logic by calling ActionService.selectCheckbox on the located checkbox element.
    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}`, }, ], }; } });
  • Zod schema definition for locator parameters (by, value, optional timeout) used in the tool's input schema.
    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'), };
  • Core implementation of checkbox selection: waits for the element using the locator, checks if not already selected, and clicks it if necessary.
    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(); } }
  • Higher-level registration call to registerActionTools, which includes the browser_select_checkbox tool, as part of registering all tools.
    registerActionTools(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