Actions45
- Manager Actions
- Mouse Actions
- Keyboard Actions
- Browser Control Actions
- Element Actions
- Image Actions
- Others Actions
- Email Actions
- Developer Actions
- General Debug Actions
Others → execute_javascript
AI-generatedSummary
Publish a JavaScript function execution request to an MQTT topic for browser context evaluation, optionally waiting for and returning a response.
Inputs
- Topic (required) — MQTT topic to publish the action payload to, representing the command channel.
- QoS — Quality of Service level for MQTT publish: 0 (at most once), 1 (at least once), or 2 (exactly once). Defaults to 1.
- Include Input Items — If true, include specified fields from the node's input items in the payload under 'inputItems'.
- Include Input Items Fields — Comma or newline-separated list of input data fields to include in the payload when 'Include Input Items' is enabled.
- Wait For Response — When true, subscribe to a response MQTT topic and wait for a reply message before completing execution.
- Response Topic (required) — MQTT topic to receive the response from, required if 'Wait For Response' is true. Defaults to 'RES_' prefix plus Topic.
- Response Timeout (ms) — Max time in milliseconds to wait for an MQTT response message when 'Wait For Response' is true. Defaults to 10000 ms.
- Parse Response As JSON — If true, attempts to parse the response payload as JSON; otherwise returns raw string.
- Script (required) — JavaScript function source code as a string to evaluate in the browser context, e.g., '() => document.title'.
- Arg (JSON) — Optional JSON-serializable argument to pass as input to the JavaScript function when executed.
Output shape
list of workflow items matching input size or a single item if none, each containing an 'mqtt' field with topic, action details, payload inputs, and optional response data if waited for.
If 'Wait For Response' is true, node execution pauses until a message is received on the specified response topic or until timeout. The response data includes the raw payload as string and, if enabled, its JSON-parsed form. If no input items are received, a single output item is returned with the MQTT message details.
Examples
Example 1: Publish a JavaScript code execution request to the 'playwright/script' topic with QoS 1, without waiting for response.
Set the Topic to 'playwright/script', QoS to 1, provide the Script as '() => document.title', and leave 'Wait For Response' off.
Example 2: Publish a JavaScript function to execute on the browser and wait for a response on 'RES_playwright/script' topic, parsing the response as JSON.
Set Topic to 'playwright/script', enable 'Wait For Response', set Response Topic to 'RES_playwright/script', provide Script source, optionally set Response Timeout and enable JSON parsing of the response.