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 this video, we will go through the implementing the IsAt method of the page objects in test automation course.
Selenium Tutorial – Page Objects in Test Automation Implementing the IsAt method
So another we have implemented the student dashboard page. Let’s go ahead and implement that method which is all that we have left to implement in order to finish the test. There is at method. It’s going to tell us that we are actually on the correct page and that the correct page is actually loaded. So I’m going to utilize my ID in order to create this method inside of the user interaction course page my T provides the code template for me and I just need to implement it. If you guys remember we were going to utilize that expand element that was going to tell us whether we’re the right page or not. Let’s go ahead and check how that looks and the gooey.
I want to go back to the previous step and click resume course so that we can see the flow. Notice this loading icon that’s very important because it tells us that we need a synchronization point and that synchronization point has to be a dynamic synchronization point because if you remember when we first started this test it took a little bit longer to load. I assumed that the application has now probably cached a lot of the information and so it loads much faster. But before that it was a little bit slower so we can’t have a static weight that’s going to be utilized for this test because it’s going to break. So we have to use a dynamic explicit weight and then we’re going to utilize this element to tell us whether we’re on the right page or not.
I’m going to utilize my developer tools of chrome and then add this element this element tells me that it has an idea called a lesson shelf toggle ideas my favorite locator to utilize with solanine web driver and is the most stable. Therefore that’s what I’m going to use coming back here. What we’re going to need to do is implement a try catch block. So I’m going to write try. And then my idea is going to fill in the rest.
And here I’m going to utilize so many drivers explicit weight.
So what I’ve done here is I’ve utilized the web driver weight in order to wait until our element is visible. Now I placed in here a variable called expanding element locator and that’s because rather than hard coding my locator here I’m actually going to use little utilizers for our UI map also known as the object repository. So I’m going to create a property that’s called expanding element locator. My Id already knows that it’s a by Clause by which is fantastic. And now all I have to do is implement the getter.
And if you remember we’re going to use the ID.
There we go. So I’ve implemented our expanding element locator which just returns a object of type of class by utilizing Dady that we got from Google Chrome. So the reason why I put this in a try catch block is because if this wait times out is going to throw a web drive or timeout exception therefore when the driver time out exception is thrown. It’s a little bit ugly because it says Web drive or timeout exception has been thrown and I was looking for the solamente. However that’s not descriptive enough for me because I prefer to have my assertion tell me exactly what went wrong. So therefore I have to utilize this until method cadged a web driver timeout exception and return false. Otherwise I’m going to return true if the element is present. So now that’s going to that result is going to get passed back to our assertion here and if it fails I get a nice error message that says the Course is not open successfully rather than an ugly message that says element not found blah blah blah.