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 Understanding BaseTest and CoursesPage of the page objects in test automation course.

Selenium Tutorial – Page Objects in Test Automation Understanding BaseTest and CoursesPage

Now let me walk you guys through the test and so that you better understand everything that’s going on along the way. I’ll point out to you all of the benefits of the page object model on how it helps you to have a more stable test. And then we’re going to wrap things up where I’m going to add another test live so that you can actually see what’s going on and how to further enhance your tests utilizing the page object model.

So we obviously have our class. Now this class is not named appropriately. Normally you can name it based on your functionality or a feature that you’re testing. And each of our classes inherits from a base test class. If I navigate to a base test class what it does is two very simple actions. If there’s a set up and tear down. So in the set up what it’s going to do is initialize a Firefox’s driver with a maximized window state for every single test and then to tear down a car driver is not equal to all we’re going to quit the driver and that’s it. So for every single test we’re going to initialize a Firefox driver and then tear it down. That is the beauty of utilizing not only the page object model but classes is that you can remove a bunch of duplicated functionality.

So now in the future if I needed to create another class I can simply inherit from the base test and I would automatically get the instantiation of the driver and the tear down of the driver out of the box without having to write a single line of code.

Obviously the beauty of inheritance now inside of the test. What goes on is actually pretty simple. All we do is create a new page. You usually name the page according to the actual web page and you may be looking at. So when we were interacting with the Course page I created a course page I would recommend that a good pattern for utilizing the page object pattern is every single HVM page that you interact with and deserves its own class. So when I instantiate this new page I obviously pass it the driver that we created in our base test and the driver gets assigned to the courses page variable. And now we can utilize it throughout our page for whatever purposes we need.

For example like the goto method the go to method will navigate directly to this URL and Link is going to click the sign and link and then return us a student log in page. You guys can see how each of the methods encapsulates the functionality that directly interacts with the web page therefore saving us from any possible changes. Because if I needed to change for example handling this sign in link the only place that I would need to change it is up here where the sign in link is identified and by the way you guys can see up here that I also have. Well I only have one element that I have my elements.

This is we can refer to it as a UI map in my all my elements will be stored in these properties that retrieve me the element with its identifier.

And whenever anything changes all I have to do is update identifier right here.

Pin It on Pinterest

Share This