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 identify radio buttons using Index of the Elements Identification course.

Selenium Tutorial – How to Identify Radio Buttons Using Index


So sometimes you may not want to use the text of a radio button to identify it. Right. You may just want to identify the radio button based on its border and that is pretty easy to do. So you have to think about is water is the type of the radio button. In this case it’s input input input. Right. So let’s get all of the inputs on this page which you do like that. And if I had that it gets me a bunch of the inputs right it gets me things that I don’t need. So in order to filter those out let’s look at the radio buttons again. They are of type for radio which is of interest to me because it will eliminate everything except the radio buttons. So I’m going to put input and then type equals radio and then I hit Enter see that it only selects the three radio buttons.

So now if I wanted to select the first one I can just put a bracket here for one and hit enter and we’ll have the selected first radio button. It starts out one not at zero unlike all other programming languages too which select me that and three would select me that zero. There is no zeros so it doesn’t select me anything. So remember starts at 1. And that allows me to select the first button. So that’s how we do it here and that’s bad. Let’s go back to our visual studio and do that there as well. So here I already typed out the code for how to use XPath in order to identify our elements.

So you can see we use the simple by class right by the X path and then we just put in our query that we want. Right. Which is what we retrieve exactly from fire path. So just put that and we find the element and then we click it and then that’s about it. We don’t really even need that back because it’s not going to do anything. So let me save this. Make sure that nothing else is uncommented. And then we can actually go ahead and run it and see it. So like our radio button.

So I’m just going to do right click here and then do a run unit tests is going to start running.

Here comes our window and I should a pause for you guys to see we’ll do that again. Cool. So it’s a like that our radio button using this locator here. Right you can see we returned an element with all of these properties. And now if we click here let’s crawl down right now the first one is selected. This one actually that’s like the second one so. Because this is going to select the first one. So I want to show you guys that it’s like the second one. And if we just do a step over you guys can see how it click the first radio button. Pretty awesome right.

Pin It on Pinterest

Share This