executeScript
Execute arbitrary JavaScript in the browser to handle edge cases that specialized automation tools cannot address. Use only after exhausting standard interactions.
Instructions
⚠️ LAST RESORT tool - use ONLY when ALL specialized tools failed. NEVER use for: clicking (use click), typing (use type), scrolling (use scrollTo), reading page elements (use analyzePage), finding elements (use findElementsByText), fetching API data (use listNetworkRequests + getNetworkRequest). May break React/Vue/Angular synthetic events. ALWAYS try specialized tools first.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"script": "<script>"
},
"name": "executeScript"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | JavaScript code | |
| timeout | No | Max wait ms (default: 30000) | |
| waitAfter | No | Wait ms (default: 500) | |
| screenshot | No | Screenshot (default: false) |