MQTT General

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

Developer → count_element

AI-generated

Summary

Count the number of elements on a webpage matching a specified CSS selector or XPath expression by publishing a corresponding MQTT message.

Inputs

  • Topic (required) — The MQTT topic to which the count request message will be published.
  • QoS — Quality of Service level for MQTT message delivery (0, 1, or 2).
  • Target — A high-level locator string for the elements to count (e.g., 'css=button').
  • XPath — An explicit XPath expression locating the elements to count, used when 'Target' is not parsed.
  • Include Input Items — Whether to include selected fields from input items in the MQTT payload under 'inputItems'.
  • Include Input Items Fields — Fields selected from the previous input items to be included in the payload if 'Include Input Items' is true.
  • Wait For Response — If true, the node waits for a reply message on a specified MQTT topic before returning output.
  • Response Topic (required) — MQTT topic from which the node waits for a response message if 'Wait For Response' is enabled; defaults to "RES_".
  • Response Timeout (ms) — Maximum milliseconds to wait for the response message.
  • Parse Response As JSON — Whether to parse the received response payload as JSON.

Output shape

a list of items corresponding to input items or a single item if no inputs, each including the original data and an MQTT payload section containing: the topic, action details (key, group, function), inputs used for counting, and, if applicable, the received response data (topic, raw message, parsed payload).

If 'Wait For Response' is true, the node subscribes to the response topic, waits up to the specified timeout for a response, and includes this data in the output. Errors during publish or response handling cause node failure unless 'Continue On Fail' is enabled. Selected input item fields can be included in the payload if specified.

Links

Discussion