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 identify a button using Xpath of the Elements Identification course.
Selenium Tutorial – How to Identify a Button Using Xpath
So over the next few lectures I want to take a lot of time to get you guys really familiar with ex-pat. I want to take you through all different scenarios from simple to really complicated so that you can understand how to identify any element at any time for any condition. And after we go through a bunch of those exercises that we can jump into Visual Studio and try out a few other things because the easiest thing after learning X bath is actually using it in Visual Studio because once you know how to identify elements the rest is pretty much irrelevant. That’s the same thing as we have been doing before. So let’s start with a Bawden element. And I would like to go through a few strategies on locating it.
So if we go up and try to look at this button ok come up here. So this is the initial XPath that is given to me right. It’s long dirty and hard to understand. If we wanted to fix this up we can look at this element down here and see what does it have. Well it has a class name right. So let’s try using a class name so you can obviously just use that in selenium web driver and use find by class name or you can come here or remove all of this. Remember classes the attributes and then just supply its value. Hit enter and it almost work. Right you guys see how it almost worked because now it’s highlighting two buttons because both of these bungs have class name.
Which leads me back to the class example when I told you guys sometimes it may be unique. Other times it may not. So that’s when we need to decide on how to identify the element. So you can see class name is not sufficient enough to pick up the right element. So what we have to do is probably use the text of the class name that tells us to pick this as opposed to this right the text in here is go to log in page and the text in here is click I mean you guys see that. So let’s put those identifiers in here. Put this on the side with that here. Oh by the way guys this is also a link as you can see.
So you can just use selenium as a link text in order to click it right. So you can use this link as you go to click me or you can use one of my favorite techniques which is using contains text to click on the button that you need. So if I do this and then hit enter it selects only those button. Those go down. You guys see that it doesn’t like this button any more. So like only this button and this is actually one of my favorite techniques to identifying some elements and you guys should get really familiar with it.