Skip to content

How do I select a Radio button

This example demonstrates selecting a radio button.

In the solution shown below, you will see that the radio button "Faimly of 2" of the "Number of people on insurance policy:" options in HICC application is selected.

Solution: 

# Command Target Value
Select the Radio Button to select "Family of 2" option
1 check //input[@id="rdo_family2"] 

Tips, Tricks, Gotchas & Best Practices:  

  • In some cases, you will see that some radio buttons are non-editable and you will need to check the editability of such buttons. You can use the assertEditable command or verifyEditable command before performing any action (click/check) on the button to confirm it is enabled for edit.
  • If the options of radio button does not have an unique "id" in any application, you can provide a temporary "id" of your choice using the command assignId. Then you can use that "id" for identifying the element.
  • If the check command fails, you can perform the action with the below-mentioned alternatives.
  • You can use either the click or mouseDown command to select the radio button.
  • If the above-mentioned commands fail to perform the action then you can use the runScript command to select the radio button.

Feedback and Knowledge Base