What will you learn in this lecture?
In the previous video, we learned the introduction to HTML attributes of this Selenium webdriver elements identification course. In this video, we’ll learn how to use Selenium for element identification.
Using Selenium Webdriver for Element Identification
Okay, so next thing that I want you guys to do is open Selenium IDE so that we can just play around with it a little bit. I want to show you guys something cool, so to get your Selenium IDE.
All you have to do is go to developer and then you’ll have that Selenium IDE button which you can also get to with Alt Ctrl S.
So I’m going to click that.
You guys see this opens and I’m going to put my webpage on the side and my selenium IDE on the side as well. So, they’re equal partners in this relationship but actually I want Selenium IDE to be a little bit smaller. It’s a little bit bigger so what you can see right now is Selenium IDE recording and that’s okay.
So what I’m going to do with it is I’m going to click on this button and you guys can see that right away, I got some code in the Selenium IDE. Let me stop recording, go back here and look back on this page.
So Selenium IDE is a nice theoretical tool used to create automated tests.
People use it to pitch record and playback because it’s so easy but in the long term, it is not maintainable at all.
Don’t ever think of using it and if you’re taking my course and you’re using this tool. I’m going to be very angry and me and you will have a serious chat.
But the reason I like Selenium IDE is it kind of gives you a good introduction to how to identify elements with Selenium webdriver. So for example, I can come over here to the commands and I can open this up and I can see a bunch of commands that Selenium IDE has.
So if I want to do something like a highlight, I can click highlight and then if I do the find, sorry, if I do right-click and then execute command, it should highlight go up did it highlight click X to highlight ah there it is okay so X you guys see highlighting in bright yellow on the right side button.
That’s awesome, right and you guys can see that using this highlight command and this target which is ID equals ID example, I am able to highlight this element and there are many other commands which obviously translate well into Selenium webdriver but those aren’t important.
The other cool thing here is this reference which obviously tells you how a command works and then there’s also a log that helps you to understand what it’s doing. So if I’m selecting this line and then looking at the log and then I click X logs the fact that I was highlighting an ID example and if it fails it comes out to the log as well.
Now, if we want to change the element that we want to click on, we can click the select button and for example let’s try this one you guys see how it’s selecting and it popped up this target value for us to locate our elements.
So that’s why so my IDE can be cool sometimes because it can help you identify an element and show you how to identify it. In fact, there are many different ways to identify this single element. In this case it’s using CSS.
You can also use Xpath in all of these cases so for example. Let me leave this and then if I do an X on this command, it should highlight that button.
You guys see that it did do it again see that but if I change to another identifier like this it should also be able to do that by hitting the X button I can see that it’s highlighting that element.
So what this is showing you is a few of the possible ways that selenium can use to identify an element and even further it’s showing you some hands is to the values that you can use with Selenium webdriver.
In the next tutorial, we will learn about Selenium IDE for object identification.
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