browser_evaluate
Evaluate JavaScript expressions directly on web pages or specific elements to interact or extract data dynamically. Integrate with Playwright MCP for browser automation without relying on 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"
}