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
What will you learn in this lecture?
In the previous video, we learned debugging the 2nd complex test of the page objects in test automation course. In this video, we will go through the learning how to evaluate elements at run time of the course.
Learning how to evaluate elements at run time
So let me clear the string and then try this command again. I think it has to be the zero element.
So try again.
Awesome. And that part worked. Now let’s just make sure that the search button is going to work as well. So what I can do is grab this here.
Paste that in the immediate window.
And then run a search and that exit. I’ve got a no such element exception because there is no such element inside of this original storage box that we tried to find.
So that kind of defeated the purpose I shouldn’t have executed that statement. That took me into this code because now you can see I have to stop and restart my test. I should have been executing drivers that find the element commands here to be able to test that out. But you saw the advantage of that right. So anyways let me fix this problem. I think it’s pretty easy to fix. What I’m going to do is use this code right here to find a search form. OK so now we’re finding the search form just like before and now using the search form we can find the element that has the Submit I.D. button. Let’s debug again and see if this works.
So these are the statements that I should be executing in the immediate window. Let’s put that in there put Firefox to the side. Fill out this one with Celine Dion because we already know that works. And then hit enter and now should search out and of course search form doesn’t exist because we’re not in the right context yet. So let me step into the object repository.
There we go.
Let’s try that. And that worked. It returned the element. Let’s see if it’s going to click.
Fantastic. And there it is you guys saw that it worked right. Let me go back. Let me clear this and we can actually finish executing the test. And knowing that it’s going to work. So I’m just going to step over this. It’s going to type this millennium string and then it’s going to click the button. Fantastic. Everything was successful. We can continue stepping through. And then is going to assert that we’re not on the page which we’re not.
And so now our test is successfully going to finish.
If we go back here you’ll see a little green check mark and the test was successful. So that was another test. The point of me again showing you the immediate window was to show you how to debug element locaters at runtime without needing to rerun your code. It’s extremely frustrating when I see automation engineers constantly rerunning the tests in order to test their locaters. You don’t need to do that debug it at runtime. Figure out how the locaters supposed to be and then replace it and then your test is going to work. It’ll save you tons of time.