app_execute_js
Execute JavaScript in the running Tauri app to access DOM, call functions, read/write localStorage, or invoke backend commands. Bypass WebDriver limitations like OS dialogs by calling backend commands directly.
Instructions
Run arbitrary JavaScript in the running app window and return the result. Not limited to clickable elements — read any DOM/JS state, call window functions, dispatch synthetic events, read/write localStorage, or invoke a Tauri backend command directly via await window.__TAURI_INTERNALS__.invoke("cmd_name", { arg }) (always present in Tauri v2). This can do anything the app's own frontend can do, including real side effects (writing config, filesystem, launching processes) — there is no sandboxing. script is a function body; return a value for a result, await directly for async work. Also the documented workaround for OS-native dialogs (file/folder pickers) that WebDriver can't drive: call the backend command directly instead of clicking through the dialog.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| script | Yes | JavaScript source, executed as a function body |