Skip to main content
Use misc_action.count_locator to count Playwright locator matches on the current page and store the integer in generated_variables—useful for pagination checks, empty-state branches, or capping loops.

Overview

  • Use when: You need the match count as a variable (e.g. decide whether to paginate, skip an empty table, or compare against a threshold) without iterating over the matches.
  • Execution: Resolves locator against the live page, waits for the first match to attach (optional timeout), then waits until the match count is stable for 1s before storing the result.
  • Same counting semantics as locator for-loops: See For Loop Node for locator_timeout and the stable-count wait.

Properties

JSON Example

After this action, {row_count[0]} is available in subsequent nodes (including if_else_node conditions and set_variable expressions). To also include the count in the task output payload, set output_variable_name:

Waiting for Matches

Playwright’s count() does not auto-wait. Without locator_timeout, an asynchronously rendered table can count as empty. Defaults match locator for-loops: wait up to 5s for the first match, then require the count to stay unchanged for 1s so streaming rows are included.
Zero matches is a valid result: the action stores 0 (with a warning) rather than failing the run.

Count Locator vs Locator For-Loop

Use count_locator when you only need the number. Use a locator for-loop when you need to act on each match.