GREAT LOTUS icon

GREAT LOTUS

10 action groups: ManagerAction, MouseAction, KeyboardAction, BrowserControl, ElementAction, ImageAction, OthersAction, EmailAction, DeveloperAction, General Debug

7. Others → execute_javascript

AI-generated

Summary

Publishes an MQTT request that runs the supplied JavaScript function in the current browser page, then returns the response when configured to wait. Use it to read page state, change the DOM, or call page functions that are not exposed by other actions.

Inputs

  • Topic (required) — MQTT topic used to publish the request.
  • Remote Port (required) — CDP port used to route the request to the intended client session. The UI defaults to the incoming item's remote_debugging_port; it also documents 127001 for a local session.
  • Script (required) — JavaScript to execute in the page. Defaults to () => document.title.
  • Arg (JSON) — Optional JSON value passed as the script argument.
  • QoS — MQTT delivery level: 0, 1, or 2; defaults to 1.
  • Include Input Items — When enabled, includes selected fields from incoming items in the request payload's inputItems.
  • Input fields — Comma-separated field paths to include when Include Input Items is enabled; supports nested paths and array indexes.
  • Wait For Response — When enabled, waits for the MQTT response before returning output; otherwise publishes without waiting. Defaults to false.
  • Response Timeout (sec) — Maximum response wait in seconds when waiting is enabled; defaults to 60.
  • Delay Next Step (ms) — Delay before continuing. Runs after the response when waiting, or after publishing when not waiting. Defaults to rand(200,1000).

Output shape

A list of items containing the MQTT response when waiting for a response; otherwise the operation publishes the request and returns without waiting for a response.

The operation response is parsed as JSON when possible. Optional selected incoming fields are sent in the request payload; exact output fields depend on the response. If a response is not received before the configured timeout, the operation fails.

Links

Discussion