What will you learn in this course?

Are you struggling with working with HTML using Selenium WebDriver? Do you know how to easily identify and manipulate an element using Selenium WebDriver? How about performing a drag n’ drop on an element? If not, then these are just a few of the questions that will be answered in this course.

This course is a complete guide on working with web elements in Selenium WebDriver! Once you are finished with this course, you will know how to work with any web elements, anytime, on any web application.

In this course from Ultimate QA, you will learn:

– Basics of HTML

– All the different locator strategies for Selenium WebDriver

– How to identify web elements using Selenium WebDriver

– Master XPath

– Navigation with Selenium WebDriver

– Web element manipulation

– Web element interrogation

– Mouse and keyboard actions with Selenium WebDriver

– Performing actions such as drag n’ drop, drawing, hovering

– Implicit and Explicit waits

– How to properly handle element identification so that your tests are not flaky

– Expected Conditions in Selenium WebDriver

Take This Entire Course for Free

What will you learn in this lecture?

In this video, we will go through the Introduction to Explicit Waits of the Implicit and Explicit Waits course.

Selenium Tutorial – Implicit and Explicit Waits Introduction to Explicit Waits

So to fix all of our issues that we’ve been having with implicit waits there is an option in selecting what driver known as an explicit waits and an explicit waits is just the code that you define to be able to sit and wait for different kinds of elements for something to occur. That’s an explicit way as opposed to using the implicit wait the method of selenium webdrive or you actually defined the code that allows you to check for a certain condition. So let’s quickly go through this test and I’ll show you guys different examples of explicit ways so that you can better understand these test classes pretty much the same as the last one that we were looking at for the implicit waits. However what I did here is just clean it up a little bit. You are right I also updated just for variety instead of going to the first page I’m taking you guys to another dynamic loading screen and this one the only difference is that all the actions are the same. But here if you look at the here and now you can see that David that we were looking for doesn’t exist. With the hello world right it doesn’t exist right now. And it gets rendered only after we click the Start button. Take a look. See that it now it exists and they showed him it wasn’t red there before that. So that’s the main difference also. What I did was I poured our element into a class variable here so that we can use it all throughout.

And it can be consistent in all of our tests and I am also going to be using a stopwatch class to show you guys how long a test takes to run in my set up method. I do the basic initialized. We have been doing creating a Firefox driver and then I’m also going to URL and I’m finding the bottom element right away. And then from there I’m going to take other actions on the tests. So the very first example that I want to show you guys have explicit waits is this. This thread does sleep. It is the worst example by far over an explicit way because you should never use it. This is exactly the same thing as an implicit wait except you’re literally just hard coding how long a test is going to wait for an element to appear.

And so if we run this test and then we can come here and see the output you can see that the time for Element identification was 10 seconds and then makes complete sense right.

Because we started the stopwatch here right before our sleeping of 10 seconds and then we obviously the element was already loaded. And so this took less than a second and then we stopped our stopwatch. And then the element was found so the length to find an element using thread that sleep is obviously going to be as long as this thread about sleep. It doesn’t matter that the element was returned within five seconds. It’s still going to wait for 10 seconds. So our problem with implicit waits is not solved here but it’s exactly the same problem. Then you can progress to a better solution to be able to have your tests dynamically updating the run times.

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

Share This