Skip to main content
Figranium provides robust control flow mechanisms to handle dynamic web pages, conditional logic, pagination, and multi-step processes.

Conditional Execution (If / Else / End)

The If block executes a sequence of actions only when a condition is met.

Structure

Every if block must be closed with an end block. An optional else block can be placed between them.

Condition Types

A JS expression evaluated in the browser page context. Must return a truthy/falsy value.
Available helpers in expressions:

Example: Login Check

Check whether the user is already logged in, and skip the login form if so:

Nested Conditions

You can nest if blocks inside each other. Each nested block requires its own end:

Loop Types

Executes a block of actions repeatedly as long as the condition remains true.
Common use cases:
  • Pagination: Click “next page” until there are no more pages.
  • Polling: Wait for a specific element or state to appear.
  • Retry logic: Re-attempt an action until it succeeds.
Example: Scraping paginated results
Prevent infinite loops by tracking a counter variable:
Iterates over all elements matching a CSS selector, executing the block once per element.
Loop variables available inside the block:Example: Clicking each item in a list
Example: Extracting data from a table
Executes a block a fixed number of times regardless of any condition.
The loop.index variable is available inside repeat blocks (zero-based).Example: Submit a form 3 times

Error Handling (On Error)

The On Error block acts like a try/catch. If any action in the main flow throws an error (timeout, element not found, network failure), execution jumps to the error handler block.
Example: Handle a CAPTCHA popup
Example: Dismiss a cookie banner that may or may not appear
Placing an empty on_error/end block before an optional action effectively makes that action non-fatal. See Error Handling for a deeper guide on retry patterns and resilient task design.

Stop Task

Immediately terminates the current task execution with a given status.
Use stop inside conditionals to short-circuit execution when a goal is already met or when an unrecoverable state is detected.

Error Handling

Learn retry patterns and resilient task design.

Variables

Use variables to build dynamic conditions and counters.

JavaScript Execution

Write custom logic for complex conditions.

Modular Workflows

Break complex flows into reusable sub-tasks.