Reputation: 494
I came across a situation where I need to wait until an element disappears (in firefox). So I tried different options but nothing worked so tried using
new WebDriverWait(Drivers._driverInstance, new TimeSpan(0, 0, 2)).Until(ExpectedConditions.InvisibilityOfElementLocated(locator));
This worked but it takes 26 seconds to run the test case. When I commented that sentence it took half of the time. Why does this particular method takes more time. Though I mentioned only 2 seconds it's waiting for nearly 10 seconds. Why is it doing so? Is there a quicker way to wait until element disappears.
Thanks.
Upvotes: 3
Views: 2720
Reputation: 9058
If you have an implicit wait in your code before this explicit wait. Remove the implicit wait and try. Mixture of implicit and explicit wait could be causing this behaviour.
Check this out and look at the accepted answer -- Clarification on the cause of mixing Implicit and Explicit waits of Selenium doc
Upvotes: 5