Restarting script

Hi,

In our testing, we have a specific scenario - I won’t call it a bug, but you know(!) - where a particular element will not be found. Currently, the failure of this image to appear will cause the script to fail, as it is impossible to continue from there.

We can work around it manually by simply closing the browser and starting again from the beginning of the script, but I wanted to know if there is anything in SenseTalk that can do this for me? Something like:

if not imagefound(3.0,“importantimage”)
start again from beginning
end if

Any input greatly appreciated :slight_smile:

Gary

Hi Gary

Yes you can do that and could do it in different ways one would be

repeat until imagefound(3,“importantimage”)
Open Browser
goto URL
perform other steps to get to your sticking point
end repeat

this would mean you never actually get out of the loop unless the image shows up.

You could change it to add the following within the repeat loop

if RepeatIndex() > 5 exit repeat

this would exit the repeat loop after a few tries but at one point give up. the next statement after the repeat loop would be the one that fails.

I hope this helps but there are other ways of doing this.