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 Introduction to Keyword Driven Testing of the page objects in test automation course.
Selenium Tutorial – Page Objects in Test Automation Introduction to Keyword Driven Testing
So that brings us to our next class here you can see I have the keyword driven class and inside of that class we are going to have a keyword driven method. What I’ve had to do here for the keyword driven method is to extract out the web driver into its own variable so that now it can be utilized by all of our tests and you can see that now our tests are composed of a bunch of keywords. Also known as methods and they look something like this. So you initialize a driver or you go to my courses page click my account link type a username and type a password and click the login button. Now this is the very lowest level of the keyword tests. So all I’ve really done is for example if we want to look at this method you can see that all the Daza is literally initialiser driver and that’s very reusable across all of our tests typing a user name for example.
Typing in user name you can see that it just deals with the user name.
Does the click clear and sending over the keys. So basically all of the code that we had before that was just out here has now been wrapped in methods. In fact let me show you guys side by side comparison so you can see what we started with and what this looks like. So over here on my left side I have our very original test before we started making it better. And over here on the right hand side you can see I have my keyboard driven test so you can obviously see right away that the keyboard driven test is already much shorter wears out about 80 lines of code versus 25 lines of code for the recorded test which is already WAY better because it’s just way cleaner and obviously much easier to maintain maintain.
Furthermore you can see that it’s actually even easier to read than the test on the left just because there’s actual methods that tell you exactly what they’re doing. And I believe they’re pretty self-explanatory right. Initially lising a driver going to of course this page clicking my account link and so on and so forth so real awesome definite improvements and the greatest thing that we’ve done here is we’ve removed all of the duplication from all of our tests. So for example if we need to initialize a driver and rather than have a remote web driver or a Firefox drive or chrome drive or whatever rather than changing every single test as it would we would have to do here on the recorded Test side on the left. We just update this method on the right. And we just update that here.
And so if you want a chrome driver just change the chrome driver and every single test is going to have that change change in a single place updated in our 500 tests. No problem. Same thing goes for any other method. If for example we want to deal with the user name and anything about the user name changes whether it’s the email identifier or whether it’s the user name itself even which obviously can change ride going from dev to test to prod. You somehow have to manage the data. We now can just change it in a single place. And now that is going to be reflected in all of our tests.
So those are definitely the biggest advantages to cure driven testing in regards to doing a record of. And of course they say maintenance time which is going to really help you to have more stable tests again when changes are coming. And you know they are coming. You have to be prepared. And this is one of the steps removing duplication is to being prepared for those changes to come.