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 how to use attributes in Xpath of the Elements Identification course.
Selenium Tutorial – How to Use Attributes in Xpath
All right so we don’t really need to worry about the period too much. The dots I don’t really use them too often they just help you to work with the nodes. However what is important is this at symbol which helps you to select attributes you guys remember attributes in h t IMAO are things that look like this writer’s body and whatever so let’s curl up here and work with this link. You guys see how this link has an attribute right here which is an ID and that it has a value. So actually when I clicked on this link the XPath that was created for me using fire pipe inside of fire Bhag is perfect. So right. Look what it did. It went through all of the tags. I don’t even need that DOD there went through all of the tags and then them regardless of what that tag was.
That’s what the star symbol means inside of these brackets where we can specify an attribute which is ID and ask for its value like that. If you supply something that doesn’t exist like this and hit enter doesn’t select anything but something that’s correct with an idea of simple elements link that works. You guys see that if I wanted a different attribute like a trap and you guys can see all of this is inside of the opening tag. Right so if I copy this a triumph instead of ID is going to be a graph OK. And then this I can supply that value and hit enter. It selects the same thing but just using a different property. You guys see that.
If I wanted to work with this clickable icon we can look at the HVM All right here. Right. And it is what a tag which means it’s a link and then it has a target attribute Atra attribute and then it has some text inside of it. I will use this graph and call it icons. US copy over that and so will replace all of this. Remove all of that stuff and the attribute is a Tref and then the value of that H is is and then we’ll hit enter. And it’s like there are two things you guys see that right this one and this one which is cool because both of them have an eighth level icon success. And yes that’s possible. Our identifier doesn’t care what tag it is. That’s why there is this wild character here.
And then for that tag it sets these parameters which is the nature of advice on success. But we have two of those. So how can we pick the one we want is we can probably pick the first one like that. And that still doesn’t help us. We can probably go to the parent and instead of a div we can do that age four. So here instead of the stars is going to be age four. And then for the age four inside of that their lives are a. So we need to do our slash a and now hit an hour and that selects only our clickable icon text. You’ve got that because we dog to the parent and inside of the parent their lives a child called a tag and that a tag we want to use it.
If icon icon success otherwise if we wanted to get to this guy we can use a div here div inside of the div. We have an aide that lives and then the A has some properties as well. See that. And now using this hierarchy we were able to pinpoint one of these elements.