What will you learn in this lecture?

In the previous video, we learned how to identify fields using XPath of this Selenium WebDriver elements identification course. In this video, we’ll have to learn how to identify radio buttons using XPath.

How to Identify Radio Buttons Using XPath

All right my friends! Let’s talk about radio buttons, right?

Radio buttons, checkboxes, all of you guys love them and hate them at the same time because they are a pain in the butt. We have some radio buttons here. And if we take a look at them, take a look, first of all, to check each of these items is their own elements. But not to mention, we also need to care about the text that is direct to the right of them, right?

But how do you check the appropriate box and read the text in order to make that happen? So if I wanted to click on this one, “I love the Quick Test Pro” button. You can see the HTML.

So we have a form. You guys see the form highlighted above and blue? This is our form inside of the form. We have several inputs, so we have input 1, input 2 and input 3.

This is the radio button. You can see type “radio”. So it’s a radio button. And then it has a value. How cool is that, right? So we can use that for example to select our appropriate radio button.

And also it has another attribute called “checked” meaning that is checked or not. So the other buttons, for example, “I love Selenium WebDriver” has checked equals to checked. The other ones do not  because they are not checked. And when they are checked, that is how you will be able to know which button is checked or not.

So if I wanted to select the second one that “I love Quick Test Pro” which I don’t anymore, I can use type radio. And it has a value “I love QuickTest Pro”, right, or even better. We could probably do something like this. And then do add value equals, what? I love QuickTest.

Let’s hit enter and that did not work. Let me copy this over and let’s see why it did not work. So that didn’t work because and value I love QuickTest.

Let’s add an input. Oh, there!. It’s “I love quick test Pro”. When I forgot the Pro, and so, of course, there is no value with “I love QuickTest”. There is a value with “I love quick test Pro”. It’s not wildcard character here.

So “I love QuickTest Pro”. You guys see how that works. And so, therefore, that allows me to select the “I love QuickTest Pro button. And of course, if you just wanted., you know to do like a wildcard character, you guys can do the app contains the text “I love QuickTest in there”. And then if it contains, that text, right, is going to select it. But with the value attribute, you cannot do that because it has to be the exact full string.

And so that’s how we can identify this radio button. And if we check it,  check out the HTML below which needs to reload. Oh! And it was not checked.  And I apologize. I’m no HTML expert. But now I remembered that this actually means that this radio button is going to be checked by default any time to the page loads.

So that’s why it has the checked equals checked.

[Tweet “Learn everything about elements identification with Selenium Webdriver.”]

Next Tutorial

In the next tutorial, we will cover how to identify radio buttons using Index.

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

Take This Entire Course for Free

[Tweet “Learn how to correctly identify elements using #Selenium #Webdriver.”]How