What will you learn in this lecture?
In the previous video, we have learned the resources of this Selenium Webdriver implicit and explicit waits course. In this video, we will learn why did this test fail.
Why did this test fail?
Now let’s go ahead and talk about implicit waits.
Here in the solution explorer what I’ve done is created a class called implicit waits and this class will help us to learn everything about well, implicit waits.
So as you can see here I’ve got a test that setup, we’re gonna go ahead and debug this test just so you can see exactly what it does.
I’m gonna come here and I’m actually gonna right-click and I’m gonna say debug tests and so while that pulls up you can see that up here I’ve got a test initialized attribute. In the test initialize attribute, we use a webdriver factory which is just a class that I created that allows us to create a Chrome driver and we store that inside of the driver a variable that’s accessible to the entire class and then in the test clean up attribute which will run after every single test, we obviously close and quit the driver. So that’s not so relevant I just wanted you to know that it’s there for your information.
And now what I’m gonna do actually is I’m gonna take this window and put it to the test and as we step through the test you’ll be able to see the actions happening in the window on the left. So now we’re gonna step over the swing step over this action and we’re gonna go to a URL which lives in a class that a class that I created called slow animation URL and it goes to that URL right there so I’m gonna go ahead and step over you’ll be able to see that happening in the browser and then once it goes to the URL.
Next thing, we’re gonna do is use this method that’s called fill out credit card info let’s see what that does might be a little bit self-explanatory which is kind of great but let’s go ahead and take a look. I’m gonna go ahead and step over that so now I’m stepping over that method did you see exactly what it did it’s filled out all this information then we’re gonna click this go button step over that and so now as you see we filled out all of this information.
We got the credit card information we got the mountain here we got the year and then this last action that we just did which was find element by he go what it did was click the purchase button and then once we click the purchase button you see that this purchase complete text appeared.
And so now we’re gonna have an assertion and this assertion checks to see if there’s this element with the ID success and if that element is displayed so let me step over that looks like it passed and then I’m actually just gonna go ahead and say continue here so the test finishes running the browser was closed. Thanks to the teardown method.
And now we have a green check mark so the test was successful. You saw exactly what the test did and you were we step through it so you saw all the code and now you understand exactly what’s happening. To fill out credit card info right here so now let’s go ahead and rerun this test so that you can see it executing in real time.
So now the test is gone I’m gonna go ahead and execute in real time. I’m just running it there’s no not gonna be any kind of debugging because you already know exactly what the test is supposed to do. So we’re just basically running it and then we’re gonna see how it works in real time so there it is filling everything out and then it’s finished and it failed.
And here’s the error message saying that this test threw an exception open QA selenium element and visible exception element not visible.
How the heck did the test just fail if we just saw it pass that is an interesting dilemma. Think about it how is that possible that our test just failed even though we just saw it passed. When you come back, I’m gonna explain to you exactly why that happened.
[Tweet “Learn everything you need to know about Selenium Webdriver implicit and explicit waits.”]
In the next tutorial, you will learn the answer to this flaky test.
What will you learn in this course?v
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
[Tweet “Learn how to correctly use implicit and explicit waits using #Selenium #Webdriver.”]