browser_fill
Fill specified input fields using CSS selectors and values to automate form interactions in Chrome, bypassing anti-bot detection for web automation and testing tasks.
Instructions
fill out an input field
Args:
selector: CSS selector for input field - required
value: The value to fill - required
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | ||
| value | Yes |
Implementation Reference
- The handler function for the 'browser_fill' tool. It validates inputs, ensures the browser is ready, finds the element by CSS selector, fills it with the provided value using send_keys, and returns a success response.@mcp.tool() async def browser_fill( selector: str, value: str, ): """fill out an input field Args: selector: CSS selector for input field - required value: The value to fill - required """ assert selector, "Selector is required" assert value, "Value is required" async def fill_handler(driver: uc.Chrome): driver.find_element(By.CSS_SELECTOR, selector).send_keys(value) return await create_success_response(f"Filled {selector} with: {value}") return await tool.safe_execute( ToolContext(webdriver=await ensure_browser()), fill_handler )
- src/mcp_server_undetected_chromedriver/server.py:199-199 (registration)Registers the browser_fill tool with the MCP server using the @mcp.tool() decorator.@mcp.tool()
- Function signature defining the input schema: selector (str, required), value (str, required). Input validation via assert statements.async def browser_fill( selector: str, value: str,