In This Course

Did you know that a recent poll revealed that 80% of QA Automation Engineers cannot run more than 100 functional tests daily, with 95% reliability? Furthermore, over 50% of these Automation Engineers struggle to run between 0 – 50 automated functional tests per day!

Functional test automation is a hard job. However, you can make your job much easier by learning a pattern known as the Page Object Pattern. The Page Object Pattern helps to resolve a lot of the problems that other automation techniques cannot. Making your test automation more stable as a result.

This course is designed to teach you how to properly code the Page Object Pattern using Selenium Webdriver with C#.

However, all of the information here is equally applicable to any other functional testing tool because the Page Object Pattern is a universal principle that makes test automation more robust. Similar to other universal concepts such as Don’t Repeat Yourself or Single Responsibility Principle.

Therefore, if you know Object Oriented programming and a different functional automation tool, you can still comfortably follow along with all of the principles and patterns that I lay out in this course.

In this course, you will learn:

– Why other methods such as Record & Replay or Keyword Driven do not work when it comes to test automation

– What the Page Object Pattern is in automation

– Advantages and disadvantages of the Page Objects

– Amazing tips and tricks on how to:

  • Implement the Page Objects using Selenium Webdriver
  • Improve your Page Objects to follow DRY Principle
  • Improve Page Objects to follow SRP Principle
  • Create amazing Page Objects for gigantic web pages

Free Video Course

In This Lecture

In this video, we will go through the implementation ObjectRepo for Student Dashboard.

Selenium Tutorial – Implementation ObjectRepo for Student Dashboard


Let’s go ahead and apply this functionality to the rest of the pages. You will learn along the way. What I’m going to do is just go through the errors that the compiler is now throwing. Obviously we’ve got a new functionality to the base page class. So we’re going to go through and fix those functionalities for each of the pages. So here it’s going to take me to the student dashboard page which implements the base page class. And if we hover over it complains that using generic type base page requires one type argument.

So we’re going to fix this by passing in a type of dynamic type of object repository that it requires. We’re going to call this student dashboard page object repository. And of course now the compiler is going to complain that it doesn’t exist. So utilizing Resharper. I’m going to create a type called Student object repository.

And this is a class that we created here. And if we look at this there is going to complain that our class that we just created doesn’t contain a parameter or less constructor. So again utilizing my ID I’m just going to implement the missing members.

So now that we implemented the missing members This class is sufficient. You can see how our student dashboard page is going to create the base page object repository inches pass and the driver so that the base page object repository can store a reference to our Web driver. I’m going to move this into its own file saw pick this selection over here just so that it’s cleaner. Let’s go back to our student dashboard page and fix the rest of the errors.

So now you can see that over here in the constructor the compiler is complaining that there is no argument given that corresponds to the required formal parameter repository of base page. What we need to do is if we look at the base page constructor we can remember that it requires a dynamic type of the object repository. We just created that object repository. So all we have to do is to initialize it so that the base page has a reference to that class.

New students dashboard page object repository is initialized and of course the compiler complains that there is no argument given and that corresponds to the formal parameter driver.

So we just need to in driver so that now our base page is going to be initialized with a driver that the base page is going to store and our object repository is going to store a driver. Now what that’s going to allow us to do is remove these properties from our student dashboard page and store them in the object repository. I’m going to go ahead and select these.

I’m going to navigate to that definition here and payes these properties here.

So of course this one is not going to be private any longer. Going to make it public and now will say this and go back to our student dashboard page. And of course the student dashboard page is now going to complain that HVM mail tag doesn’t exist and neither does resume user interaction scores button. But that’s very easy to fix because now in our base page class we have a reference to the object the repository.

So utilizing the object repository we can get our elements that now live there object repository Da’ath and you can see all the options that come up which are Abita the two elements that we have in there and we one of them is HVM Aldag. Also we can do the same thing here Dot. And resume user interaction course.

Bawden now also exists in our ogic repository so you can see how amazing that is because now whenever we need to interact with an element we store it in the object repository and we access it using the object repository member

Pin It on Pinterest

Share This