Skip to main content

How can I wait for an object to disappear?

Problem

I need to wait until an object disappears.

Context

My application has reports it generates, and it can take time. When a report is generating, an animated Please Wait image and text appears. Once the report is generated, the page loads and the Please Wait image and text goes away.

Solution

Option A

Wait until the object is no longer visible, but only wait for a maximum amount of time. Notice the not (!) negating the isVisible statement.

Action

Accessor

Wait

60000,!(isVisible(paragraph("Please Wait")))

Option B

If you want to wait, as well as check something else while waiting, you could use .wasNotFound() in a While. Note: The Set Search Retries lowered to and then restored after the While completes.

Action

Accessor

Set Search Retries

2

While

!(paragraph("Please Wait").wasNotFound())

Wait

1000

End While

Set Search Retries

12


Last updated: June 02, 2023

If you have any feedback on this topic, please contact us at documentation@appvance.ai