How to make loop to work with visualVerify function

Hi,

I am trying to run a ‘‘prediction’’ loop which means I am looking for a button and while that button is not present do a certain action and repeat the visualVerify function. When the button is finally found it should exit the loop. My problem is that I don’t know how to make this loop to work and I don’t know how to include the function itself in the loop. My code looks like this:

{
“Command”: “visualVerify”,
“Target”: “button_dpi_120_relative.png”,
“Value”: “”
},
{
“Command”: “if_v2”,
“Target”: “${!LastCommandOK}”,
“Value”: “”
},
{
“Command”: “XClickRelative”,
“Target”: “button_dpi_120_relative.png”,
“Value”: “”
},
{
“Command”: “else”,
“Target”: “”,
“Value”: “”
},
{
“Command”: “XClickRelative”,
“Target”: “otherbutton_dpi_120_relative.png”,
“Value”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”
}
]
}

As you can see, the VisualVerify function is outside the loop so if it fails , even if I make it repeat the loop it will still see it failed because the verify function does not run again. I would appreciate any help here, thank you!

How about using ThrowError so when the button is found it stops?

https://ui.vision/rpa/docs/selenium-ide#throwerror