What will you learn in this lecture?
In the previous video, we learned how to use absolute XPath to identify an element in selenium of this Selenium webdriver elements identification course. In this video, we’ll have to learn how to use relative XPath.
How to Use Relative XPath to Identify an Element
So a relative expat is nice because it is a much cleaner way to identify elements and it is more stable so the beauty of that is you usually identify the element once using relative XPath and then you don’t have to worry about that element again changing locations.
Depending on how you identify but it’s a very nice thing to have because you wouldn’t have to worry about the element changing positions and so on and so forth with its nice relative XPath.
It will be very stable similar to relative and absolute folder paths if any of you are familiar with those right and absolute folder paths gives you the exact location of the file.
A relative folder path gives you the location of the file relative to something else right you may be in one folder and will say go up to folders and then go inside this other folder rather than always being located on the same on the full absolute pack.
The only problem with relative XPath is that it takes more time to find the correct identifiers using relative techniques but after we’re done with this lesson you guys are going to be so amazing that you guys won’t mind doing it.
And so a relative XPath might look something like this, so if I want for example this button rather than doing all of this I’m going to remove all that.
All right so it would be something like this.
See that if I hit enter it highlights this button that I want and if I wanted button one, I can have button one.
You guys see that compare that to the absolute XPath and you can right away see what’s much cleaner and easier to use not only that it’s much easier to understand where this is pointing to right as opposed to something like this like where the hell is this element point to I no idea.
So relative XPath is where we’re going to spend most of our time focusing and really mastering this skill and once we’re mastered with XPath identification, you guys will be so good and at the top of your game ready to identify any element anytime using any tool especially with Selenium webdriver.
In the next tutorial, we will cover how to use pick any tag from HTML body.
What will you learn in this course?
Are you struggling with working with HTML using Selenium WebDriver? Do you know how to easily identify an element using Selenium WebDrriver? Do you know how to manipulate that web element? Do you know how to perform 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, any time, on any web application.
“Relevant content that I will be able to apply to my automation tests *immediately*, a VERY effective presentation approach (evolving the same example and comparing/contrasting), and an excellent teacher / presenter. Thank you so much for your time and sharing your knowledge Nikolay!.”
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