playwright_fill
Automate form filling by entering specified values into designated input fields using CSS selectors, streamlining web interaction tasks.
Instructions
Fill out an input field
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| selector | Yes | CSS selector for input field | |
| value | Yes | Value to fill |
Implementation Reference
- src/playwright_server/server.py:249-258 (handler)FillToolHandler class with handle method that executes the playwright_fill tool logic by filling the specified selector with the given value using Playwright's page.locator().fill()class FillToolHandler(ToolHandler): async def handle(self, name: str, arguments: dict | None) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: if not self._sessions: return [types.TextContent(type="text", text="No active session. Please create a new session first.")] session_id = list(self._sessions.keys())[-1] page = self._sessions[session_id]["page"] selector = arguments.get("selector") value = arguments.get("value") await page.locator(selector).fill(value) return [types.TextContent(type="text", text=f"Filled element with selector {selector} with value {value}")]
- JSON Schema definition for the playwright_fill tool inputs in the list_tools handlertypes.Tool( name="playwright_fill", description="Fill out an input field", inputSchema={ "type": "object", "properties": { "selector": {"type": "string", "description": "CSS selector for input field"}, "value": {"type": "string", "description": "Value to fill"} }, "required": ["selector", "value"] } ), types.Tool(
- src/playwright_server/server.py:338-338 (registration)Registration of FillToolHandler instance in the tool_handlers dictionary used by the call_tool handler"playwright_fill": FillToolHandler(),