Radio button controls provide users with the ability to make a single choice from a number of alternative options. So, in some cases, you may need to know whether the current radio button is selected or not (for example, if you want your test to select various sets of options depending on the already selected buttons).
While testing radio button controls, you can use specific properties and methods of the corresponding program object to perform certain actions and obtain data stored in controls. You can call these methods and properties from your keyword tests, as well as from scripts. This topic describes how to work with the needed properties and methods from your scripts. However, when testing a control from your keyword test, you can use the same methods and properties calling them from keyword test operations. For more information, see Keyword Tests Basic Operations.
You can use the
wChecked property to determine the state of the needed radio button control. If the radio button is selected, the
wChecked property returns True; otherwise, False. The following code demonstrates how to obtain information about the state of the current radio button:
Log.Message("This option is selected");
Log.Message("This option is not selected");
... if RB1.wChecked: Log.Message("This option is selected") else: Log.Message("This option is not selected") ...
If RB1.wChecked Then
Log.Message "This option is selected"
Log.Message "This option is not selected"
if RB1.wChecked then
Log.Message('This option is selected')
Log.Message('This option is not selected')
Log.Message("This option is selected")
Log.Message("This option is not selected")