Wait until icon is not present

There is an icon, which is changing, when an operation is in progress. Execution should wait until it disappear.
I use this:

WebUI.waitForElementNotPresent(findTestObject('Object Repository/inprogress'), 20)

When spinner icon is present class contains this: fa-spinner fa-spin.

It doesn’t wait.

Make sure that only the class attribute is checked in object attributes to identify the object through the class spin.
Your spinner might be present for more time than that.
So try using WebUI.delay(NoOfSeconds) or increase seconds in waitForElementNotPresent

Appearance is controlled and tested by the visibility keywords.

Presence in the DOM (visible or not) is controlled and tested by the presence keywords.

Because you said:

You should use



1 Like

I tried to use this, but doesn’t work. Element has two icons, which are changed, when operation start and stop.

@kavyavijaya : It is hard to estimate duration of process, so I would like to find some more universal solution.

Yes it does. What doesn’t work is your method of describing a problem

Sorry, but you asked for that.

No it doesn’t. HTML elements and TestObjects do not have “icons”.

As you said yourself, the class attribute changes on… well, “something” but I can’t tell you what since your post is so vague.

Hey, plaid, you’ve been around a while – you know how this stuff works and you know how this forum works. Don’t make it like pulling teeth just to help you. Here’s a refresher, take the advice and figure it out.

Yeah. Thanks for correcting. :smile:

Hi plaidshirtakos,
Please share the html code for better analysis and solution that you are expecting. Since you are using a fa spinner icon, to determine the loading process a class of spin is added through javascript or you are using 2 icons based and loading the required accordingly. That’s what i have deduced.
The solution will be the same in either of the cases(universal in your words :smile: ).
Sharing the code will give you better results.

Kavya Ankem

@kavyavijaya: I see this in normal state:

<i aria-hidden="true" class="fa fa-times"></i>

and see this when button is clicked:

<i aria-hidden="true" class="fa fa-spinner fa-spin"></i>

Thanks for sharing the code. So, create two test objects with the class in the object attributes checked.
So for one object the class will be fa fa-times while for the other the class will be fa fa-spinner fa-spin.
Now apply wait for element not visible( fa fa-spinner fa-spin) or
wait for element visible fa fa-times.