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 waits
4. Understand what a DefaultWait is
5. Comprehend how to use all of the different types of waits during appropriate situations
In This Lecture
This is a quiz about why your test fails when it runs on your Selenium WebDriver. This video also shows you a step by step guide on how you can run basic steps so that it will show you that the Dynamic Loading Elements Test Failure has passed successfully. It will then give you as quiz and ask you why the test was unsuccessful when you did it again.
Selenium Tutorial – Quiz: Why Does Your Test Fail When It Runs?
I’m going to come over here, I’m going to insert a break point. Then right here, I’m going to run this test. Come over here Debug Tests and then it’s going to start executing. We will carefully step through the test so that you can see what happens.
It’s coming up. It brought up the window. Let me pan this to the side and pan the window over here. My TryFind method, you could see guys that the basic initialize, all I did was create driver so that did the set up.
When inside the TryFind Method, that was called in here and I’m going to Step Over each of the steps. I’m going to Step over this and that’s going to the web page that I just showed you guys.
Then it’s going to click the Start button. Now that I click the Start button the next thing it’s going to happen, is it’s going to find the element that contains the element, “Hello, World.”
It’s successful, let me run through this. It cleaned up and it did the tear down, browser is gone. If we wait for a second, it’s going to show us that our Dynamically Loading Elements Test Failure has passed successfully.
What if I don’t step through this and I just run the test? Let’s give that a shot.
I’m just going to come over here and do Run Tests. I’m going to put this on the side so you guys can see Firefox when it comes up.
Here’s Firefox. What happened? You guys see this? This little X write here, Test Failed. If I click on, this what shows me is the message, is that Unit Test 1 is Dynamically Loading Elements Test Failure threw an exception.
What is the exception? Element is not currently visible and so may be interacted with. That’s really weird because the test just passed. I showed you guys, I was stepping through it and everything worked fine.
Why is it that it just failed when I ran the test? Take a moment to think about it and when you come back I’ll give you the answer.