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 the previous video, we learned the introduction to single responsibility principle of the page objects in test automation course. In this video, we will go through how to add a BasePage class to our page objects for the course.

How to add a BasePage class to our page objects?


By adding the base page to our student log in page and all of our other child pages we’ve done an excellent thing and remove duplication. We now have a single place where our constructor automatically assigns the driver that we Pessin to a class variable called driver which obviously removes duplication from all of the pages. So whenever we call something like a student log in page that constructor gets called whenever we create it and we pass in a driver to that constructor.

However, before that’s done the code is going to move up to the base page class and pass it to the driver that we passed to the child page. And now is going to assign it to this driver class variable and we don’t need to repeat that through any other page.

Let me implement that on all of the other pages just so you can better understand.

Let me just quickly check if I’ve missed any other page. I just did four pages and I think I’m good and I’ve got my base page in here in my page objects folder. So fantastic. So you can see that every single page now utilizes the base page and none of them need this line of code and their constructor.

And they don’t need that member variable.

You can see how I’m removing all this duplication.

Fantastic and having this base page will actually help us in the future to extract out any other common functionalities that we may find along the pages, for example, utilizing a web driver weight or maybe utilizing some kind of user interactions classes or maybe you’re going to have actions that you need to do something like clicking on the javascript. You may put all of that inside of the base page class so that all the common functionality is obviously shared amongst all the classes and you don’t need to duplicate your code. That’s the beauty of this base page class.

And you’ll see how we further enhance it in the future.