What will you learn in this lecture?
In the previous video, we learned how to identify link and icon using XPath of this Selenium web driver elements identification course. In this video, we’ll have to learn how to identify fields using XPath.
How to Identify Fields Using XPath
Let’s talk about fields and web edits and how to work with those.
So I got two fields here that we can fill out and I can click in here. And right away, you can see that the XPath given to me contains an ID. Excellent! So we can use that XPath, right?
And I wouldn’t complain about this just because it has an ID as if it has an ID. We can obviously use the ID value to pass into the web driver doing something like by that ID. Just like that. And also I mean, that’s about it if it has an ID. That’s great! If you want to get complicated, right?
I can show you guys how to get complicated if you want to get to the “p” level. So rather than a star let’s put a “p” here and inside let’s say if I hit enter now that doesn’t select anything, right? So let me copy this over. Go back here! So inside of the “p,” we have an input living.
So input. And the input has an ID that’s there. So if I had enter, that works exactly as required. But why is that necessary? That’s just extremely complicated over-engineered. And we don’t need that at all. Therefore, something like this with a star, of course, works just as well except it’s not over engineered. Just a simple query.
So I would just simply use the identifier.
Don’t make your life harder! If you don’t need to do it just use the simple identifier. Selenium provides us for this just passing the value. And that’s it, email field! Let’s look at the email field. The same thing! It has an ID. Use the ID. No problem.
In the next tutorial, we will cover how to identify radio buttons using XPath.
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