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 how to add a BasePage class to our page objects of the page objects in test automation course.

Selenium Tutorial – Page Objects in Test Automation How to add a BasePage class to our page objects

By adding the base page to our student log in page and all of our other child pages we’ve done an excellent thing and remove duplication. We now have a single place where our constructor automatically assigns the driver that we Pessin to a class variable called driver which obviously removes duplication from all of the pages. So whenever we call something like a student log in page that constructor gets called whenever we create it and we pass in a driver to that constructor. However before that’s done the code is going to move up to the base page class and pass it to the driver that we passed to to the child page. And now is going to assign it to this driver class variable and we don’t need to repeat that through any other page.

Let me implement that on all of the other pages just so you can better understand.

Let me just quickly check if I’ve missed any other page. I just did four pages and I think I’m good and I’ve got my base page in here in my page objects folder. So fantastic. So you can see that every single page now utilizes the base page and none of them need this line of code and their constructor. And they don’t need that member variable.You can see how I’m removing all this duplication.

Fantastic and having this base page will actually help us in the future to extract out any other common functionalities that we may find along the pages for example utilizing a web driver weight or maybe utilizing some kind of user interactions classes or maybe you’re going to have actions that you need to do something like clicking on the javascript. You may put all of that inside of the base page class so that all the common functionality is obviously shared amongst all the classes and you don’t need to duplicate your code. That’s the beauty of this base page class. And you’ll see how we further enhance it in the future.

Pin It on Pinterest

Share This