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 Fixing final page and executing functional tests

Selenium Tutorial – Fixing final page and executing functional tests

 

So let’s go ahead and finish implementing the rest of the page object repositories.

We have three more errors but I believe that is because they need to fix one more class. So we are here at the user interaction course Page going to add that and create a new object repository type create that type. It’s going to complain that it needs a parameterless constructor to implement the parameterless constructor going to move it to its own file come back here to initialize that new page object and not Page object saw a repository pass in the driver.

And now just get this element out of here.

Of course it complains how it doesn’t have a reference to the Solomons. So let’s utilize our object a repository property to give it access to the expanding element locator. Excellent and I believe that this resolves all of our errors.

It does and what we can do now is go ahead and run the tests to validate that everything is still working.

Our tests are here let’s go back to the test explore let’s build everything in our test to explore we should see a description of enhanced page objects which we do.

And let’s go ahead and run these selected tests. Okay interesting.

One of our tests has failed.

Let’s take a look. The course did not open successfully and that’s for this assertion here.

Let’s quickly take a look at that assertion.

All and of course you can see that there is a problem here with this test in that it only waits for three seconds. But you saw that loading icon should be waiting for much longer than three seconds. So it waited for three seconds and then it timed out and through that exception. So instead. Let’s go ahead and wait for up to 20 seconds actually 30 seconds because I believe the message on that loading icon said that it may take up to 30 seconds for the course to load.

So let’s try to rerun this test now. All right there it is just a simple synchronization problem. And by the way if you run into synchronization problems I have an entire free tutorial on synchronization issues it’s selenium of driver synchronization course where you can learn how to properly synchronize your tests so that they don’t fail inconsistently and they’re not so flaky that can help you out if you run into these kinds of issues that you just saw with my test anyway so that’s about it. That is the beauty of the object repository.

And again just to do a quick summary take a look at our courses page initialising and base page that creates a dynamic type and we define this dynamic type whenever we are implementing this base page implementation. And we created that type.

We’re going to store all of our elements in there and then we just need to initialize that page whenever we create our child page.

And now we can utilize all of our elements using the object repository property. And that’s going to give us access to the relevant object repository which is in this case courses page ogic repository or if it’s a user interaction course Page object of course page it will be a user interactions course Page object repository. So again utilizing a single keyword will give us access to only the relevant objects.

How fantastic is that. I think that’s the beauty and of course now each of our pages follows the single responsibility principle because now it doesn’t manage objects. It doesn’t manage elements and interact with the page. Now each of our pages only interacts with the page and manager of objects is the object repository