browser_unselect_checkbox
Unselect checkboxes on web pages using locator strategies like ID, CSS, or XPath to automate form interactions and testing workflows.
Instructions
Unselect a checkbox
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| by | Yes | Locator strategy to find element | |
| timeout | No | Maximum time to wait for element in milliseconds | |
| value | Yes | Value for the locator strategy |
Implementation Reference
- src/tools/actionTools.ts:398-416 (registration)Registers the browser_unselect_checkbox tool with the MCP server using locatorSchema and a handler that delegates to ActionService.unselectCheckboxserver.tool('browser_unselect_checkbox', 'Unselect a checkbox', { ...locatorSchema }, async ({ by, value }) => { try { const driver = stateManager.getDriver(); const actionService = new ActionService(driver); await actionService.unselectCheckbox({ by, value }); return { content: [{ type: 'text', text: `Unselected checkbox` }], }; } catch (e) { return { content: [ { type: 'text', text: `Error unselecting checkbox: ${(e as Error).message}`, }, ], }; } });
- src/services/actionService.ts:117-123 (handler)Core handler logic: locates the checkbox element, waits for it, and clicks it if currently selected to unselect it.async unselectCheckbox(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(); } }
- src/types/index.ts:29-35 (schema)Zod schema defining the input parameters (by, value, optional timeout) used by 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'), };