Repeat same command 10 times, searching for a element before pressing ok

Hi All

I am trying to create as automation where a OK button gets pushed if a certain element does not exist, but this OK button could potentially exist 10 times in a page.

See attached image, the possible match found is what I want to check for, if it doesn’t exist, press OK, if it does ignore. Then move onto the next one, after doing it 10 times, move onto the next page.

The Ok might not always exist either. Is this possible? Thought it was a combination of waitforelementnotvisible,click and while.

Correct!

You can use waitforelementnotvisible OR (if that fails for some reason on the page) use visualVerify | image of OK button (see here). But if waitforelementnotvisible works, it is the faster solution!

Thanks for that @ulrich. Could you please advise how to use while for a text term, all the stuff I google show how to use it for numbers. Eg if less than 10

It appears that if the element is there, it still goes and presses the OK button. I need it to check if the “other possible” portion of the element exists, as sometimes it can say 2,5,7,10,20, basically any number of matches could be found, and if it doesn’t exist, press OK, then move onto the next one.