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
In This Lecture
In this video, we will go through the fixing the StudengLoginPage.
Selenium Tutorial – Fixing the StudentLoginPage
Just go ahead and further implement the rest of the page objects so that you can further cement all of the knowledge that you’ve acquired here. I’m going to go back to our aerialist and just proceed through the rest of the pages. So I’m going to come over here and again the student log in page is complaining that the base page needs a value for its generic type. Utilizing my ID I’m going to pass that in. And now we need to create our object repository. So the naming convention is student log in page object repository.
Of course the compiler is going to complain that the students log in page object repository does not exist. So let’s implement it again using my ID I’m going to create a type student object repository over here on the left hand side. That’s going to bring me down here and this type is a class. That’s right. And then of course the compiler is complaining that we need a parameterless constructor.
So again using the idea I’m going to select to implement the missing members that missing members are implemented are classes happy the compiler is happy. Let’s move this to its own file. Again this moving to its own file is thanks to re shopper not the Visual Studio ID. I don’t believe that you can do this in Visual Studio id e to move it to its own file. OK next.
Now that we have a concrete type testing for the generic page object repository we need to initialize it through our base page class and so now we’re just going to initialize the new student log in page object repository and past it. The driver that it requires And so now that’s initialized and everything is satisfied. All that’s left to do is to extract the elements so that they live in the appropriate class where they cannot affect the student logon page.
So I’m going to take these gun and navigate to the student logon page object repository. I’m going to paste these elements there. They’re not going to be private they should be public awesome. So now that they’re public of course the compiler complains that it doesn’t have a reference for all of these variables so we need to give it a reference all of these variables by allowing you to access through the object repository.
Fantastic. Our class is now ready as well. Again utilizing logic repository we don’t need to know what elements are accessible to the student logon page. All we need to know is that we have an object repository and we can access all of the elements through that object repository. The variable that lives inside of the base Bache class