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 how to use CSS to identify an element in Selenium of the Elements Identification course.

Selenium Tutorial – How to Use CSS to Identify an Element in Selenium

 

The next so any more of a drive identifier that I want to talk about is the CSS selector which basically allows us to use CSSA commands to navigate through the HTML. Now why the CSA selector is good is because it’s easier to write and it looks simpler. However, there are some problems with it is that and not available on some older browsers and maybe over a specific period of time in a few months maybe in a year this point will not even be relevant because those older browsers will hardly be in the picture. But that is one of the cons and therefore usually there is a competition between CSSA next bath right people are like all you see. SS No use XPath you see SSX path or whatever. I think it doesn’t really matter which one you use. I prefer XPath because first of

I prefer XPath because first of all it is available on all browsers and that the conventions are not as hard to learn for XPath as they are for CSS just because XPath is a little bit more intuitive with its conventions. And also there are two resources that I want to point you to guys that you may want to make yourselves aware of. So first there are source labs dot com slash resources slash selenium slash CSSA dash elector’s where they talk about identification using CSS and they actually give you examples right here. XPath here CSX ex-pastor VSS X-Pac CSSA examples and they talk about it and then they actually claim that it’s faster. But then there is another resource that I want to show you guys which is by Dave Haffner.

These guys are actually really cool. I suggest you guys check them out. I always read up his blog he provides a lot of solid content and he actually did a test to compare the speed of CSA us versus XPath and he compared it on different browsers to see how they compare. And he actually said that XPath is actually faster than she says and there are a few other differences but I actually trust them. And even if she assesses faster the next bath the differences are so negligible that I don’t think it really matters. So I’m not going to focus on CSSA so much for you guys because I think it’s less relevant than X-Band. But if you want to learn more. Like I said there’s this CSSA tutorial from source Labs which is excellent and they can help you guys learn it. But we’re going to really focus on

But we’re going to really focus on path and learn on dominating ex-pats so that you guys can be awesome at identifying elements. Well either way let me quickly show you what a CSS identifier would look like. So if you are hovering over this button you guys see up here that this is a XPath example. This string right here that’s an X map I can switch it to us and then I can hover over it again. There you go. And that’s a C S S example that hover over this button. See that see how it’s a little bit different and just like hash tag idea example or like this dot the Button class example. Sorry I actually clicked on that one or something like this which to me is very confusing.

But those are the identifiers. And that’s how it looks. Let’s try to use that in selecting a web driver. So first I want to bring your attention to this button over here. Right. I’m going to hover over it and this is the C-s ass that is provided to me by firebugs this value right here. So that’s what I can use my CSX. Now we also have many other options. Right. Do you guys see what we can do here we can. It’s a link so we can use link text. You guys see that we can use partial in text we can use the Tref property but if you use the right of property nothing is going to click on many links. I can show you guys that later or we can use the class which may be unique but it’s actually not because you guys can see that because of this identifier there are two buttons being highlighted.

You guys see that one too. So this identifier is actually not unique. So the CSX would normally look like this. And by CSX selecting you pass that value and but that is not unique enough for us to click on only this Bawden therefore we cannot use it. So rather than teaching you a CSSA way of identifying this we will learn to identify this using X path.

Pin It on Pinterest

Shares
Share This