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 Implementing the functionality of the first test of the page objects in test automation course.

Selenium Tutorial – Page Objects in Test Automation Implementing the functionality of the first test

So utilize MIT I’m going to create a type called complicated page. Again. Give me a few minutes to finish implementing the class.

You can go ahead and watch and then of course I’ll explain everything after.

So as you can see here I’ve created the complicated page page object. Of course it’s inheriting from the base page utilizing our object repository pattern created a complicated page object repository and of course that in here is from the base page object repository and initializing it with a driver.

Now we just need to implement the other methods.

So next I’ve implemented the go to method the go to method simply navigates to a URL the ELSE hard coded which is a bad idea. But for our purposes it’s OK because I’m not focused on these minute little changes that need to be made to page objects we’re focused on the bigger ideas and improving your page objects for test automation. So this is the go to method very simple and than I’ve implemented that is the method and method again is also very simple where we’re checking that the driver URL contains this treeing called complicated page. Right in the far URL contains a string.

Then we are at the right page. Implement the clicking the first Twitter button.

Let me figure out a locator for this button.

Probably will have to use that’s bad because I didn’t add any kind of special properties to these guys. Awesome. So utilizing this Xpath by checking for the title I get back all of the five Twitter buttons.

So if I want to deal with the first one.

Awesome There you go. So what I have done here and we’ll try this out to see if it actually works is I’ve located all elements by their Xpath which equals at title Twitter. So is going to return me all of the Twitter bunds of which we have five right you guys can see that here in the developer console that I’ve ran the XPATH in and returns me five and we have five Twitter buttons. And so if I want to click on the first Twitter button I’m just going to get that collection and then get the first element in that collection. And that’s going to be the first Twitter button.

This is a bad job by me all of these should have IDs but of course I was creating this page just as a sample for you to practice with so obviously locating them was a bit more of a pain and a bit more brutal. But that’s not the purpose of the purposes for me to demonstrate how to clean up a complicated HMO page into a simple page object class. So I’ve done that here by finding the first Twitter button so that about wraps up our test. We’ve created the complicated page class that has its own complicated page object repository the complicated page object repository stores our web element which is called the first Twitter button. And then we have two methods inside of our complicated page which does a go to and. Oh we have three methods I’m sorry it does go to checks that we are at the right page and then click the first Twitter button.

I’m going to move these to their own files now and then we’re going to check the test to make sure that it works.

Pin It on Pinterest

Shares
Share This