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 the previous video, we learned implementing the IsAt method of the page objects in test automation course. In this video, we are going through the process on how to implement the UserInteractionsCoursePage.
How to implement the UserInteractionsCoursePage?
So my Visual Studio idea makes it extremely easy for me to implement methods that are written in a test driven development style and then be placed in the right location so I can use my ID and then it’s going to allow me to correct what I need to do.
And so you can see now I can create a method in the appropriate page which is exactly what I want to do and I’m sure I know that Java and many other ideas allow you to do the same thing. So we did that and now we just need to implement it. And so resuming the user interaction scores that involves what that involves clicking a button. So let’s go back to our Web site and then let’s spy on this resume Corps button and see what that’s about. So looking at this Dom I think I’m actually going to use this A.F. property in order to be able to click on this button.
We can go really deep into why we would want to utilize different kinds of locators. There are many different kinds of tutorials on that but that’s not the purpose of this course. So I’m not going to get really deeply into why you should use one locator over another. I’m going to utilize that XPath. So I’m just going to test out my X path condition down here in Chrome developer tools. Awesome So that’s my bath condition. We can see that it’s identified one of wan buttons if I hover over it I can see that is the exact wand that I want so I’m going to grab the second bag. I’m going to go back to our ID and now I’m going to implement this method. It’s complaining about my resume user interactions of course BOTTEN. So I’m going to create a property.
It’s going to be iWeb element and then I’m going to return.
By X path X path.
Of course it a link to semi-colon awesome so here’s our element and I’m going to move this up to the top so it stays closer to all of the other locators.
There you go.
So now this works excellent. However, we have a problem here in that we need to click this button which is going to take us to another page. So we need to implement that here and return a. Let me see what we were calling you here a user interaction course page. User interactions course page. And of course, that doesn’t exist. So I’m going to use my ID to go ahead and create a type called user interactions course page which is fantastic.
And of course, all we need to do now is return in this method and user interaction of course page and passing a driver. And of course, the user interaction of course Page is going to complain that it doesn’t have this construct are implemented. So again using IEEE It’s really simple to create this constructor and the constructor is pre-created for me.
What I’m going to do here is assign just like up here. I’m going to have a property that stores our driver.
And then I’m going to assign the driver to our variable that’s passed then and now we have our user interactions course page.
What I’m actually going to do is move this to its own class so that now if we look here we have our user interactions course page that has been added in our page objects folder.
And now let’s go back to our test and see what’s left to implement.