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
What will you learn in this lecture?
In this video, we will go through the Fixing final page and executing functional tests of the page objects in test automation course.
Selenium Tutorial – Page Objects in Test Automation Fixing final page and executing functional tests
So let’s go ahead and finish implementing the rest of the page object repositories.
We have three more errors but I believe that is because they need to fix one more class. So we are here at the user interaction course Page going to add that and create a new object repository type create that type. It’s going to complain that it needs a parameterless constructor to implement the parameterless constructor going to move it to its own file come back here to initialize that new page object and not Page object saw a repository pass in the driver.
And now just get this element out of here.
[Of course it complains how it doesn’t have a reference to the Solomons So let’s utilize our object a repository property to give it access to the expanding element locator. Excellent and I believe that this resolves all of our errors.
It does and what we can do now is go ahead and run the tests to validate that everything is still working.
Our tests are here let’s go back to the test explore let’s build everything in our test to explore we should see a description of enhanced page objects which we do.
And let’s go ahead and run these selected tests. Okay interesting.
One of our tests has failed.
Let’s take a look. The
Course did not open successfully and that’s for this assertion here.
Let’s quickly take a look at that assertion.
All and of course you can see that there is a problem here with this test in that it only waits for three seconds. But you saw that loading icon should be waiting for much longer than three seconds. So it waited for three seconds and then it timed out and through that exception. So instead. Let’s go ahead and wait for up to 20 seconds actually 30 seconds because I believe the message on that loading icon said that it may take up to 30 seconds for the course to load.
So let’s try to rerun this test now. All right there it is just a simple synchronization problem. And by the way if you run into synchronization problems I have an entire free tutorial on synchronization issues it’s selenium of driver synchronization course where you can learn how to properly synchronize your tests so that they don’t fail inconsistently and they’re not so flaky that can help you out if you run into these kinds of issues that you just saw with my test anyway so that’s about it. That is the beauty of the object repository.
And again just to do a quick summary take a look at our courses page initialising and base page that creates a dynamic type and we define this dynamic type whenever we are implementing this base page implementation. And we created that type.
We’re going to store all of our elements in there and then we just need to initialize that page whenever we create our child page.
And now we can utilize all of our elements using the object repository property. And that’s going to give us access to the relevant object repository which is in this case courses page ogic repository or if it’s a user interaction course Page object of course page it will be a user interactions course Page object repository. So again utilizing a single keyword will give us access to only the relevant objects. How fantastic is that. I think that’s the beauty and of course now each of our pages follows the single responsibility principle because now it doesn’t manage objects. It doesn’t manage elements and interact with the page. Now each of our pages only interacts with the page and manager of objects is the object repository