execute_script
Execute arbitrary JavaScript in browser or mobile commands to read/modify DOM, trigger events, or run Appium actions when no dedicated tool exists.
Instructions
Executes arbitrary JavaScript in browser page context or Appium mobile: commands. Can read/modify DOM, trigger events, terminate apps, or run Android shell commands — use only when no dedicated tool covers the action. Browser: pass JS in script, use 'return' for values, string args matching selectors auto-resolve to elements. Mobile: use 'mobile: ' syntax in script with args array (e.g. "mobile: pressKey", "mobile: activateApp"). Prefer click_element/set_value/get_elements for standard interactions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Arguments to pass to the script. For browser: element selectors or values. For mobile commands: command-specific parameters as objects. | |
| script | Yes | JavaScript code (browser) or mobile command string like "mobile: pressKey" (Appium) |