browser_evaluate
Execute JavaScript expressions on web pages or specific elements using Playwright MCP. Enables precise interaction with web content through structured accessibility snapshots without screenshots or vision models.
Instructions
Evaluate JavaScript expression on page or element
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| element | No | Human-readable element description used to obtain permission to interact with the element | |
| function | Yes | () => { /* code */ } or (element) => { /* code */ } when element is provided | |
| ref | No | Exact target element reference from the page snapshot |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"element": {
"description": "Human-readable element description used to obtain permission to interact with the element",
"type": "string"
},
"function": {
"description": "() => { /* code */ } or (element) => { /* code */ } when element is provided",
"type": "string"
},
"ref": {
"description": "Exact target element reference from the page snapshot",
"type": "string"
}
},
"required": [
"function"
],
"type": "object"
}