What will you learn in this course?

Are you struggling with working with HTML using Selenium WebDriver? Do you know how to easily identify and manipulate an element using Selenium WebDriver? How about performing a drag n’ drop on an element? If not, then these are just a few of the questions that will be answered in this course.

This course is a complete guide on working with web elements in Selenium WebDriver! Once you are finished with this course, you will know how to work with any web elements, anytime, on any web application.

In this course from Ultimate QA, you will learn:

– Basics of HTML

– All the different locator strategies for Selenium WebDriver

– How to identify web elements using Selenium WebDriver

– Master XPath

– Navigation with Selenium WebDriver

– Web element manipulation

– Web element interrogation

– Mouse and keyboard actions with Selenium WebDriver

– Performing actions such as drag n’ drop, drawing, hovering

– Implicit and Explicit waits

– How to properly handle element identification so that your tests are not flaky

– Expected Conditions in Selenium WebDriver

Take This Entire Course for Free

What will you learn in this lecture?

In this video, we will go through the further understanding SRP of the page objects in test automation course.

Selenium Tutorial – Page Objects in Test Automation Further understanding SRP

So let me draw a few more examples of classes that you may encounter in your test automation. So this is going to represent the class line. We’re going to call it the Logger class. It’s going to have a few methods like is going to have a method called log debug that takes in a string called the message and then it’s also going to have a login for a class that takes a string called the message. Now does this class follow the Single Responsibility Principle. Does it have a single reason to change? I think the answer is yes because in its current state this class is a logging class and the only reason it has to change is when the logging functionality needs to be updated. For example if you need to update the log debug method to do something different you’re only going to be changing the login function logging functionality and you’re not going to affect any other class to another class.

Call this a Button class. It’s going to have a method called click method called gets text so in its current form what you see here is does the Button class follow the Single Responsibility Principle.

Again the answer is yes because it’s a Button class that has the functionality of clicking and getting text and that’s it changing anything within the button. The class is only going to affect the Button class. OK. I think you’re starting to get the idea. Let’s go take a look at our page objects and see if they follow the Single Responsibility Principle. So here I got our courses page and if we take a look here.

Does this class.

Have a single reason to change. And this topic here is actually pretty interesting and I believe it’s a controversial topic but my point of view I think that this class has two reasons to change. I believe that this class can change because of the locators and because of the actions that the class takes on the page. So I believe that it has two reasons to change because the locators may change how we deal with the locators may change how we find them and so on and so forth. And also the methods themselves can also change because the actions can obviously change. And so to me in my point of view it has two reasons to change and so it does not follow the Single Responsibility Principle. Again this is very controversial some people believe that when you extract the objects from the class then it no longer follows the page object pattern. But I believe that enforcing the Single Responsibility Principle is more important than making sure that the page object only contains all of the elements inside of it. And so what I’m going to do now is code up a solution for these page objects and then I’m going to show you how we fix the Single Responsibility Principle so that you can see how we’ve improved our code.

Pin It on Pinterest

Share This