Radiobuttons
With Radiobutton control, you can refer to a single radiobutton or radiobutton group.
Possible options to select a radiobutton or radiobutton group:
Name | Parameter(s) | Type | Description |
---|---|---|---|
radioButton | dataTestId | string | Searches for a radiobutton by value of a Pega data-test-id attribute, same as radioButtonByDataTestId or radioButtonGroupByDataTestId |
radioButtonByDataTestId | dataTestId | string | Searches for a radiobutton by value of a Pega data-test-id attribute, same as radioButton or radioButtonGroupByDataTestId |
radioButtonGroupByDataTestId | dataTestId | string | Searches for a radiobutton group by value of a Pega data-test-id attribute, same as radioButton or radioButtonByDataTestId |
radioButtonByPartialId | id | string | Searches for a radiobutton by partial value* of an id attribute (same as radioButtonGroupByPartialId ) |
radioButtonGroupByPartialId | id | string | Searches for a radiobutton group by partial value* of an id attribute (same as radioButtonByPartialId ) |
radioButtonByAriaLabel | areaLabel | string | Searches for a radiobutton by value of an aria-label attribute** |
radioButtonGroupByAriaLabel | areaLabel | string | Searches 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');
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
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.
Name | Parameter(s) | Type | Selection type | Description |
---|---|---|---|---|
click | value | string | by partial id | Selects a radiobutton element by inner text (same as select ) |
options? | { index?: number, timeout?: number, retries?: number, interval?: number } | |||
click | value | string | by aria-label or data-test-id | Selects a radiobutton by value of the value attribute (same as select ) |
options? | { index?: number, timeout?: number, retries?: number, interval?: number } | |||
select | value | string | by partial id | Selects a radiobutton element by inner text (same as click ) |
options? | { index?: number, timeout?: number, retries?: number, interval?: number } | |||
select | value | string | by aria-label or data-test-id | Selects a radiobutton element by value of the value attribute (same as click ) |
options? | { index?: number, timeout?: number, retries?: number, interval?: number } |
Assertions
Specific assertions
Name | Parameter(s) | Type | Description |
---|---|---|---|
shouldBeChecked | value | string | Verifies if the checkbox element has a checked attribute |
options? | { index?: number, timeout?: number, retries?: number, interval?: number } | ||
shouldBeUnChecked | value | string | Verifies if the checkbox element does not have a checked attribute |
options? | { index?: number, timeout?: number, retries?: number, interval?: number } |
Common assertions
Name | Parameter(s) | Type | Description |
---|---|---|---|
shouldBeVisible | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element exists and is visible |
shouldExist | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element exists |
shouldNotBeVisible | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element exists but is not visible |
shouldNotExist | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element does not exist |
shouldBeEnabled | options? | { index?: number, timeout?: number, assertionTimeout?: number, interval?: number, retries?: number } | Checks if the element doesn't have a disabled attribute |
Wait for
functions
Name | Parameter(s) | Type | Description |
---|---|---|---|
waitUntilVisibility | options? | { timeout?: number, interval?: number, retries?: number } | Waits for the element to be visible |
waitUntilInvisibility | options? | { timeout?: number, interval?: number, retries?: number } | Waits for the element to be invisible |
waitUntilElementExists | options? | { timeout?: number, interval?: number, retries?: number } | Waits for the element to exist |
waitUntilElementNotExist | options? | { timeout?: number, interval?: number, retries?: number } | Waits for the element not to exist |
Actionability check
ActionabilityCheckTypes == attached
| stable
| visible
| enabled
| editable
Name | Parameter(s) | Type | Description |
---|---|---|---|
waitForSelectActionabilityCheck | check types | [] | Waits for the element to pass all the selected actionability check types |
isFilterByVisibility | boolean (true by default) |
e.g.
await pega.radiobutton('24972094628502592').waitForSelectActionabilityCheck(['attached', 'visible', 'stable']);
IsVisible and IsExists functions
Name | Parameter(s) | Type | Description |
---|---|---|---|
isVisible | options? | { timeout?: number, interval?: number, retries?: number } | Returns true if the element exists and is visible |
isExists | options? | { timeout?: number, interval?: number, retries?: number } |