Skip to content

Conditional Actions

All workflow actions have optional properties called "ConditionGroup" and "NotConditionGroup". You can define whether or not an action is executed by assigning one of these two properties a name that corresponds to the name of a matching rule or the "ResultVariableName" defined in the ExecuteScript action.

If you want the action to execute because the result was true, then set the "ConditionGroup" property. If you want the action to execute because the result was false, then set the "NotConditionGroup" property. Actions will execute if no values for the two condition group properties are defined or if there is no result for the condition group name referred to in the action.

For Example:

Header:
  Name: Example Conditional Actions
  ApplicationName: Examples
  RequiresLogin: False
Actions:
- Navigate:
    Url: '{endpoint}/'
- WaitForContent: {}
- Snapshot:
    SnapshotRule:
      Name: SignInFound
      Action: Equal
      Pattern: Sign In
- Click:
    ConditionGroup: SignInFound
    Nearest: Any
    Patterns:
    - Sign In
- WaitForContent:
    ConditionGroup: SignInFound
- Snapshot:
    ConditionGroup: SignInFound

In the above example we give a name to the snapshot rule called "SignInFound". The rule searches for a clickable UI element called "Sign In". If the element exists then SignInFound will evaluate to true. The subsequent actions will only execute if SignInFound is true.