browser_evaluate
Executes JavaScript in the current page context and returns the serialized result as JSON. Ideal for extracting data or automating interactions.
Instructions
Execute JavaScript in the current page context and return the result. The script should be a JS expression or a function body that returns a value. Examples:
'document.title'
'window.location.href'
'() => document.querySelectorAll("h2").length'
'() => { const el = document.querySelector("#price"); return el ? el.innerText : null; }' Returns the serialized result as JSON.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |