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 Implementing the functionality of the first test.

Selenium Tutorial – 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 new R-AL 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 you Arel contains this treeing called complicated page. Right in the far you Arel 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 X path 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 X path 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 sex bath 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