Skip to content

Matching Rules

There are two types of matching rules for browser-based workflows:

  • SnapshotRule: This rule is used to match UI elements on the page - similar to how the FindXXX actions are used to find UI elements. There is a rich set of matching actions, including regular expressions, that can precisely target a UI element.
  • HtmlRule: This is similar to the snapshot rule with regard to matching actions, but this rule is applied to the HTML DOM of the page.

You can use either of these match rule types in the Wait action or the Snapshot action. If you are using a rule in the Wait, a match means to stop waiting. If used in a Snapshot, the rule engine fails the workflow when the pattern does not match.

Another powerful option for these rules is the ability to extract data from a match using a named group in a regular expression. If the regular expression matches the data for the named group, a workflow parameter will be assigned. The workflow parameter's name will match the name of the named group and the value will match the extracted value. Subsequent workflow actions can then use this workflow parameter.

For Example:

Header:
  Name: Example Matching Rules
  ApplicationName: Examples
  RequiresLogin: False
Actions:
- Navigate:
    Url: '{endpoint}/'
- WaitForContent: {}
- Snapshot:
    SnapshotRule:
      Action: Regex
      Pattern: 'Open\s(?<id>[0-9]+)'
- Click:
    Patterns:
      - "Open {id}"

In the above example the page is returning links that start with the word "Open" followed by a number. The numbers are changing each time so the regular expression allows Venari to match on one of the numbers and then click on it without having to know the number beforehand. The "id" token in the expression designates the numeric part of the overall match.

Finally, each rule has an optional "Name" property. If you supply a name for the rule, the result of the match can be used to make certain actions conditional. Whenever a "Name" exists on a match rule for a snapshot action, the action will never fail, even if it does not match the rule. Instead the workflow will continue on and subsequent actions can determine if they execute or not based upon the match being true or false. See Conditional Actions for more information.