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 analysis of ObjectRepository implementation of the page objects in test automation course.

Selenium Tutorial – Page Objects in Test Automation Analysis of ObjectRepository implementation

So let’s dip into the base page class and analyze what’s going on exactly and how we implemented this new object repository. And don’t worry the first one I implemented it just so I can show you and explain to you everything. And then we’re going to go through and implement this for the rest of the pages so that you can better understand how to do this. So I’m going to step into the base page class and you can see that the base page class is initialized with a dynamic type of type Object repository. And that we’re utilizing a constraint where I’m saying that the object repository needs to be over type base page object repository. So if we go into the base page object repository you can see that it just going to store the reference to a driver.

So whenever it gets initialized you just have to pass in the driver and then there’s going to store it so that it can use the driver for all of its object repository classes. So let’s go back here. So when we are initializing our base page with a dynamic type of type Object repository we can call our base page constructor and our base page constructor is going to take a drive or type which it has always been taking before and now it’s also going to take a dynamic type of repository this repository, of course, has to be has to implement the base page object repository. So that means you can have many different kinds of repositories. And as long as they implement the base page object repository they are going to work.

And so that object that we pass in gets assigned to our object repository variable that we have in our class and then now we can use this object repository property to access the dynamic object repository that we pass. Then let’s go back to the courses spacially you can see all of that again. So of course this page inherits from a base page and it initializes a courses page object repository see this is the dynamic type here. Each of our page objects that inherit from the base page are going to have their own object repository so that they can access the appropriate objects from that object repository that are relevant only to that page. So this one is a courses page object repository. So if I navigate to courses page object repository you can see that now we have the element that we used to have in the courses page. It leaves in the object repository and it just has a simple constructor that initializes the base page object repository to passing the driver. And then we utilize that driver within our child page our child object repository.

It’s that simple. So again we initialized it with a course page object repository. So whenever this page is created it’s going to go ahead and initialize our base page class and it’s going to initialize the base page class by passing into values of value for the driver and create a new instance of the dynamic type of object repository. So when we’re creating that dynamic type it simply gets assigned to the object repository which can be any type. And now we can utilize it for dealing with our objects. And be utilized for dealing with objects in this manner.

Will you just call the object repository which just lives in the base page class. You can use the dot notation and now you’re going to have access to all of the objects that live inside of that object repository making it way easier to know which objects you can and interact with as opposed to scanning the entire class visually and trying to remember what is available inside of that class what elements are available for you to play with. Let’s proceed because I know this might be extremely confusing. Let’s go ahead and implement this for another page. And I am 100 percent confident that you will understand this by the time we’re done implementing this on all of the pages

Pin It on Pinterest

Shares
Share This