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

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!