What will you learn in this lecture?
In the previous video, we learned using Selenium IDE for object identification In this video, we’ll learn using an ID to identify elements of this Selenium webdriver elements identification course.
Using an ID to Identify Elements
Basically, the point is that you can use Selenium IDE to get a little bit familiar with how it helps you to identify elements. But overall it’s not the best tool for the job.
The best tool for our job is going to be Firebug on Firefox browser. And we’re going to learn how to use that tool like excellent automation engineers.
So with all of that said, let’s go into the types of different locators that we can use to identify our objects and those include an ID, a class name, and name link text or Partial link text, XPath, CssSelector DOM which stands for Document Object Model which if any of you have ever used QTP you may be familiar with it. If not no big deal we’ll learn about it here.
So let’s talk about these guys one at a time.
The ID is the best way to identify an element because it’s always unique. If an element has an ID then you can identify it and be certain that that element will almost never change.
So if you’re working with developers and you are in a modern company that likes to be progressive and make good advances, you can ask your developers to give you elements with IDs so that it can make your job easier.
Right. If you can spend one minute identifying an element as opposed to 15 minutes, that’s a significant advantage per element.
For example here this element is going to have an ID and you can see that it has an ID. And using this ID you can identify.
This element that I just highlighted does not have an ID and therefore you can see the XPath that appear here is extremely complicated. And so to identify this is going to be much harder than to identify something with an ID.
So let’s get a little bit familiar with Firebug.
So if I click this button here and come over here and click this button on the automation practice page you guys can see how force is highlighted in the HTML.
And second up here this is the Xpath that shows how to identify the element. Now don’t worry about that yet but notice this value.
Okay. This is how you identify an element with an ID. And this is how an identification of an element looks without an I.D.
Which one is looking simpler, this one or that one?
I’ll go with the first choice.
[Tweet “Learn everything about elements identification with Selenium Webdriver.”]
In the next tutorial, we will learn how to use an ID to identify elements with Selenium Webdriver.
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
[Tweet “Learn how to correctly identify elements using #Selenium #Webdriver.”]
Nikolay Advolodkin is a self-driven SDET on a lifelong mission to create profound change in the IT world and ultimately leave a legacy for his loved ones, community, and the world at large. Today, he serves as the CEO and Test Automation Instructor at UltimateQA.com and contributes informative articles to leading test automaton websites like SimpleProgrammer.com and TechBeacon.com