How to trigger an error if an image is still there? (or: Wait until image disappears)

Note: If you replace visualSearch with OCRSearch in the above macro, you can use the same code to wait for text to disappear (or appear).

Compared to image search, OCR text search has the advantage that changing the screen resolution or switching between MacOS and Windows does not affect it.