In This Course

In this course, you will:

1. Learn the problems that can occur as a result of improper synchronization

2. Learn how to use Selenium Webdriver explicit waits

3. Master Selenium Webdriver implicit wait

4. Understand what a DefaultWait is

5. Comprehend how to use all of the different types of waits during appropriate situations

Free Video Course

In this Lecture

This discussion talks about the other disadvantage of an implicit wait, which is waiting for the loading icon before proceeding. This condition is seen often when doing an implicit wait.  This discussion also emphasizes that these disadvantages shows up when you have thousands of tests running.

Selenium Tutorial – Disadvantages of an Implicit Wait II

The other disadvantage with implicit waits is a condition that I’ve seen all too often. We sometimes as automation engineers want to make sure that an element does not appear on a page before proceeding.

For example, if I come over to our famous dynamic loading and I click the starred button, look at this loading icon. Has it not been so common that a lot of us will wait for this loading icon before proceeding? Imagine that rather than checking for this “Hello World!” text, this page is not static. This loading icon is used to represent the loading of our page between different kinds of pages.

For example, if  I’m navigating to this page, there’s a loading icon. If I’m navigating to this page, there is a loading icon present rather than looking at this thing up here spinning. I am seeing a loading icon here. Imagine that. Imagine that I’m clicking this stuff and seeing a loading icon.

We wouldn’t be able to know what’s coming up on the next page, rather we would need to wait until the loading icon has disappeared before we proceed with our next action. That happens a lot and I’ve used that technique many times at my job. When we want to make sure that an element is not present on a page, our implicit wait is going to wait for the duration of the time until that element has expired and has thrown and no such element exception.

If we have set this to thirty seconds for our page, we are going to be wasting and sitting for thirty seconds waiting for the bar to not be present before catching the exception and the proceeding with the rest of our actions. That is obviously a huge waste of time because we don’t need to wait for that long. We just need for the element to disappear and once it disappeared, we can proceed.

That’s not how a FindElement works, you are going to find your element, which is the bar and it’s going to wait for thirty seconds. Then when the NoSuchElementException has thrown, we are going to catch it and then proceed with the rest of our actions.

Conclusion

I hope that both of those disadvantages are very clear to you.  Implicit wait, is it great to start helping you right your test, make them stable and make them run but it’s going to be very inefficient if you have thousands of tests running  and you are going to be wasting valuable, valuable seconds that you cannot waste when you have thousands of tests that are automated, even a hundred of tests.

Therefore, Selenium WebDriver, provides us a much better solution than the implicit wait and that it is known as an explicit wait. The explicit wait I’m going to cover further in the next lecture.

0 Shares
Tweet
Share
Share