Skip to main content
Version: 7.5.5

Radiobuttons

With Radiobutton control, you can refer to a single radiobutton or radiobutton group.

Possible options to select a radiobutton or radiobutton group:

NameParameter(s)TypeDescription
radioButtondataTestIdstringSearches for a radiobutton by value of a Pega data-test-id attribute, same as radioButtonByDataTestId or radioButtonGroupByDataTestId
radioButtonByDataTestIddataTestIdstringSearches for a radiobutton by value of a Pega data-test-id attribute, same as radioButton or radioButtonGroupByDataTestId
radioButtonGroupByDataTestIddataTestIdstringSearches for a radiobutton group by value of a Pega data-test-id attribute, same as radioButton or radioButtonByDataTestId
radioButtonByPartialIdidstringSearches for a radiobutton by partial value* of an id attribute (same as radioButtonGroupByPartialId)
radioButtonGroupByPartialIdidstringSearches for a radiobutton group by partial value* of an id attribute (same as radioButtonByPartialId)
radioButtonByAriaLabelareaLabelstringSearches for a radiobutton by value of an aria-label attribute**
radioButtonGroupByAriaLabelareaLabelstringSearches for a radiobutton group by value of an aria-label attribute**

*Partial id and **Aria-Label

Using checkbox methods, we are interacting with one specific element, while radiobutton always involves GROUP og elements. That's why the value is a mandatory parameter for each radiobutton method. Radiobuttons can be found in DOM by aria-label attribute, data-test-id or by partial id (the structure of the radiobuttons ids in Pega is always the same: a common part of the id + the value., e.g. in the example below it`s 'eccdbbaeMale' and 'eccdbbaeFemale'. We need a COMMON part of the id - 'eccdbbae'). Aria-label allows to find a radiobutton group easily and usually is equal to radiobutton group label. Check the example below:

<div data-template="" data-test-id="Gender" role="radiogroup" aria-label="Gender" radvalue="" data-ctl="RadioGroup" class="radioTable"><div>
<span class="col-3">
<input id="eccdbbaeMale" type="radio" name="$PpyWorkPage$pGender" aria-describedby="$PpyWorkPage$pGenderError" value="Male" class="Radio rb_ " style="vertical-align:middle;" aria-invalid="false">
<label title="" for="eccdbbaeMale" class="rb_ rb_standard radioLabel">Male</label>
</span>
<span class="col-3">
<input id="eccdbbaeFemale" type="radio" name="$PpyWorkPage$pGender" aria-describedby="$PpyWorkPage$pGenderError" value="Female" class="Radio rb_ " style="vertical-align:middle;" aria-invalid="false">
<label title="" for="eccdbbaeFemale" class="rb_ rb_standard radioLabel">Female</label>
</span>
</div></div>

As a result, possible options are:

await pega.radioButtonGroupByAriaLabel('Gender').shouldNotBeChecked('Male');
await pega.radioButtonByPartialId('eccdbbae').shouldBeVisible('Female');
await pega.radioButtonByPartialId('eccdbbae').click('Male');
important

We do not provide an option to select a radiobutton by css or xpath because we need to be very precise with the selectors in order to be able to find a given option to check/uncheck. If there is a need to define a radiobutton group via xpath or css use a custom element elementByXpath or elementByCss

Main action functions

important

For radiobuttons, main actions work slightly different depending on selection type. Elements selected by partial id are based on the inner text; radiobuttons selected by data-test-id or aria-label are based on value attribute.

NameParameter(s)TypeSelection typeDescription
clickvaluestringby partial idSelects a radiobutton element by inner text (same as select)
options?{ index?: number, timeout?: number, retries?: number, interval?: number }
clickvaluestringby aria-label or data-test-idSelects a radiobutton by value of the value attribute (same as select)
options?{ index?: number, timeout?: number, retries?: number, interval?: number }
selectvaluestringby partial idSelects a radiobutton element by inner text (same as click)
options?{ index?: number, timeout?: number, retries?: number, interval?: number }
selectvaluestringby aria-label or data-test-idSelects a radiobutton element by value of the value attribute (same as click)
options?{ index?: number, timeout?: number, retries?: number, interval?: number }

Assertions

Specific assertions

NameParameter(s)TypeDescription
shouldBeCheckedvaluestringVerifies if the checkbox element has a checked attribute
options?{ index?: number, timeout?: number, retries?: number, interval?: number }
shouldBeUnCheckedvaluestringVerifies if the checkbox element does not have a checked attribute
options?{ index?: number, timeout?: number, retries?: number, interval?: number }

Common assertions

NameParameter(s)TypeDescription
shouldBeVisibleoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }Checks if the element exists and is visible
shouldExistoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }Checks if the element exists
shouldNotBeVisibleoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }Checks if the element exists but is not visible
shouldNotExistoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }Checks if the element does not exist
shouldBeEnabledoptions?{ index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number }Checks if the element doesn't have a disabled attribute

Wait for functions

NameParameter(s)TypeDescription
waitUntilVisibilityoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to be visible
waitUntilInvisibilityoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to be invisible
waitUntilElementExistsoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element to exist
waitUntilElementNotExistoptions?{ timeout?: number, interval?: number, retries?: number }Waits for the element not to exist

Actionability check

ActionabilityCheckTypes == attached | stable | visible | enabled | editable

NameParameter(s)TypeDescription
waitForSelectActionabilityCheckcheck types[]Waits for the element to pass all the selected actionability check types
isFilterByVisibilityboolean (true by default)

e.g.

await pega.radiobutton('24972094628502592').waitForSelectActionabilityCheck(['attached', 'visible', 'stable']);

IsVisible and IsExists functions

NameParameter(s)TypeDescription
isVisibleoptions?{ timeout?: number, interval?: number, retries?: number }Returns true if the element exists and is visible
isExistsoptions?{ timeout?: number, interval?: number, retries?: number }