Reputation: 1142
I need to check whether all elements of a class are not present in the DOM. Say, I want all the elements with the class .loading
to not present in the DOM. I know I can do this:
browser.wait(EC.stalenessOf($$('.loading')), 5000);
My question is whether this code will wait for all the loading
class to go away or just the first one? If it waits for only the first one, how will I make it work for all of them? Thanks in advance :)
Upvotes: 0
Views: 37
Reputation:
yes, this should wait until ALL elements matching the locator are not present
But for future, when in doubt, you can write your function instead of using ExtectedConditions
library. In this case, you could do
let loading = $$('.loading');
await browser.wait(
async () => (await loading.count()) === 0,
5000,
`message on failure`
);
In fact, this is what I'm using to handle multiple loading animations ;-)
Upvotes: 1