Click All Matches for xClick

For Selenium IDE style web automation we have the @pos syntax to loop over all buttons. For UI image search the same method is available as # syntax (since @ is already taken for the confidence level):

n8_dpi_96.png@0.85#${!times}

So you can use this to loop over all matches above your confidence threshold.

UI Vision ranks all matches above the confidence threshold with numbers #1,#2,#3,#4,… from left to right, top to bottom (just as reading English). You can use the “Find” button to test this!

Here I use it to press all 3 “8” buttons:

Macro:

{
  "Name": "Calc1",
  "CreationDate": "2020-5-8",
  "Commands": [
    {
      "Command": "pause",
      "Target": "1000",
      "Value": ""
    },
    {
      "Command": "times",
      "Target": "3",
      "Value": ""
    },
    {
      "Command": "XClick",
      "Target": "n8_dpi_96.png@0.85#${!times}",
      "Value": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": ""
    }
  ]
}

n8

1 Like