Select Check Box or Radio Button in Selenium

In this tutorial you will see, How can you select the Check box or Radio Button in Selenium. In Selenium, we can manage the Checkbox and Radio Buttons easily.


To perform click we have one method click() in selenium. To select or check the Radio Button or Checkbox we need to find the web element and click on that element.

HTML structure of checkbox and Radio button always contains a tag name “value”, We can also extract the value of that checkbox or radio button using getAttribute() method.


Let’s design a Selenium script to see the function of radio Buttons.

Test Case – Verify that user is able to Select the Male Radio Button on the Facebook signup page.


Solution— We will design the Test Script with Steps.

  1. Open the Facebook in Browser.

  2. Verify that Male radio button is already selected.

  3. If yes, Deselect it .

  4. If No, Select the radio button.

  5. Verify that button is selected or not.


Execute the above code in your local and see the result.


Guys it’s highly recommended to practice each and every tutorial. Use previously learned tutorials and design some professional scripts. If you want demo sites for practice please write us we will share the practice site URL with you.


Selenium Tutorial:

If you liked this video, then please subscribe to our YouTube Channel for more video tutorials.

0 Comment

Leave a Reply