What will you learn in this lecture?

In the previous video, we have learned how to make implicit wait work. In this video, we will have a quiz on implicit waits.

Quiz on Implicit Waits

So with all that I think you’re now ready to dominate implicit waits. And so of course, I have a quiz for you.

A fun, a little exercise that I’ve created for you to cement all of your knowledge.

Let’s talk about this exercise very quickly.

So one thing I want to clarify again is that there are basically two types of exceptions that are thrown. There’s an exception thrown that is called element not visible exception and guess when that is exception is thrown by Selenium well when an element is not visible in the HTML, meaning that the element is there in the HTML but it’s just hidden so in that case an exception of type element not visible is thrown.

And then we have a second type of exception that is thrown by Selenium and that is no such element exception. That’s exactly what you just saw at ultimateqa.com. And when do you think that exception is thrown, well it’s thrown when there is no such element on the page.

So in the ultimate QA’s case, we were looking for an element. By the success, there was no such element present. Hence, no such element exception was thrown.

Okay and so what I’ve done here for the exercise for you is I have the test. I have one, two, three, four, five tests. Okay, two of which on you one test here goes to this URL called hidden element URL.

We can take a look at it here hidden element URL. Okay, so in here there is an element present but we can actually open it up so that you can see and then there’s an element present and then it sets in implicit wait and clicks which is this method right here. So just such an implicit wait and checks for an element with ID finish.

Okay, let me pull up the browser and go to this URL. And now, inspect this area here and so then we’re looking for finished. Right. So finished.

Look, we have two elements.

Well, we’re not looking for this JavaScript function. What we’re looking for is for this element with ID finish.

Okay, and it’s there. Okay, so that’s why I said it’s a hidden element URL and the other one is the element rendered after URL. So it means that the element is rendered after you click the button

Let me show you this one.

Oh, so we’re looking for finish. Just be careful. Make sure you retype your query after you reload because you saw, in the beginning, it didn’t find anything. But then after I retyped, it did find that the JavaScript function.

But the JavaScript function is meaningless because we’re looking for an element with ID and there is no element with ID finish. So it’s rendered after you perform a certain action.

So it’s not on the page so explain those tests to you.

Those are the two tests and what I’ve done for each of these tests is I’ve placed this press attribute called expected exception. So I’m expecting that each of these tests will throw a specific type of an exception. 

So, this one will be a null element not visible exception and this one will be an element not visible exception then there this one will be in no such element exception and so on and so forth for all of the tests with the goal of making each of the tests pass because I know the exact conditions of each element and I know whether an implicit wait will work or will not.

So the problem that I have for you is the expected exceptions that I’ve placed on each of these test methods.

Are they correct?

So for example, if I run all of these tests, will all of them pass? Will this test right here test one thrower element not visible exception or will it throw a no such element exception? Will this test right here throw a no such element exception or an element not visible exception or even something else that I didn’t show you?

Yet that is what you have to figure out. You need to go ahead and think about it.

Think about the state of the elements that we’re looking for think about whether an implicit wait will work or will not and then figure that out when you come back I’ll give you the answer.

Next Tutorial

In the next tutorial, we will have the answer to the quiz on implicit waits.

What will you learn in this course?

Are your automated functional tests flaky? Do they randomly fail and you are unsure why? Is your team frustrated with the “instability” of your Selenium Webdriver tests?

If you are interested in fixing all of these problems and making your tests more stable, then you need to understand how to use all of the different types of waits in Selenium Webdriver. Knowing how to handle synchronization issues will make you a top-notch Test Engineer!

“The best tutorials I have ever seen, simply awesome. I take off my hat in front of you, you are a gorgeous professor, I am speechless to express how satisfied I am with these tutorials.” -Lisbey

In this course from Ultimate QA, you will learn:

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

– Learn how to use Selenium Webdriver explicit waits.

– Master Selenium Webdriver implicit waits

– Understand what a DefaultWait is

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

Take This Entire Course for Free

Nikolay Advolodkin is a self-driven SDET on a lifelong mission to create profound change in the IT world and ultimately leave a legacy for his loved ones, community, and the world at large. Today, he serves as the CEO and Test Automation Instructor at UltimateQA.com and contributes informative articles to leading test automaton websites like SimpleProgrammer.com and TechBeacon.com

Pin It on Pinterest

Shares
Share This