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

Take This Entire Course for Free

What will you learn in this lecture?

In this video, we will go through the process on how to figure out if an element contains some text using xPath of the Elements Identification course.

Selenium Tutorial – How to Figure Out if an Element Contains Some Text Using Xpath

 

And this statement right here let’s break it down. So we have our double forward slash which ABC select and the tag in the body and we drill down to the tag. And for the a tag we want to use to expand functions. This guy and this guy actually X-Pac functions that tell us what we want. So we want to use the X-Pac function that says contains. And what does it contain. It contains text that says click the text that says Click Me. You guys see that. And this is one of my favorite tools for identifying all the different types of buttons because a lot of times elements want to get those unique identifiers as you guys see here.

And so you can actually identified by text. Yes it socks when the text changes but you just have to update the text. And a lot of times the tags does not change if you want to. For example click the email me button. You just change the text to email me like this and then if I had an hour that did not work why didn’t it work. Let’s see. Because first of all it’s not the email me is not inside of the a. You guys see that it’s not inside of the A It’s inside of the span. So you come here and page this and then instead of the A We make it a span. Right. That’s the there’s this guy right here spanne see that and then and here we put the text email. It doesn’t even have to be the full thing. And I hit enter. Boom.

Now I got what I want to click on. You guys see that just by changing the text and it’s really nice because you can pass in any string and as long as it contains that string you can click on that element. So now you guys saw three different strategies to identifying this body. We saw this one where you can use the link text which is equal to click me. We can use this guy and we can use this guy. So probably overall the best strategy to do here is to use linked text because it’s the most simple one but again that’s always up to you to decide. But when you look at all of this written now versus this to me much simpler to just use by DOT link text and then you just pass and the link text right.

Pin It on Pinterest

Shares
Share This