RadioButtonGroupElement
Playwright element wrapper for <vaadin-radio-group>. Provides helpers to select by label/value and assert selected state.
Component Tag
vaadin-radio-group
Implements
HasLabelElement
HasEnabledElement
HasHelperElement
HasValidationPropertiesElement
Factory Methods
getByLabel
public static RadioButtonGroupElement getByLabel(Page page, String label)
Get the radio button group by its accessible label. Uses ARIA role RADIOGROUP.
The accessible label of the radio group
Returns: The matching RadioButtonGroupElement
Constructor
public RadioButtonGroupElement(Locator locator)
Create a new RadioButtonGroupElement.
The locator for the <vaadin-radio-group> element
Methods
selectByLabel
public void selectByLabel(String label)
Select a radio button by its label text.
The label text of the radio button to select
selectByValue
public void selectByValue(String value)
Select a radio button by its value.
The value of the radio button to select
public RadioButtonElement getRadioButtonByLabel(String label)
Get a specific radio button by its label within the group.
The label text of the radio button
Returns: The matching RadioButtonElement
setValue
public void setValue(String value)
Set the selected value by label.
The label of the radio button to select
assertValue
public void assertValue(String value)
Assert the selected value by label.
Expected label of the selected radio button, or null/empty for no selection
Usage Examples
Basic Selection
RadioButtonGroupElement group = RadioButtonGroupElement.getByLabel(page, "Basic RadioButtonGroup");
group.assertVisible();
group.assertEnabled();
group.assertValue(null);
group.selectByLabel("Option 2");
group.assertValue("Option 2");
group.selectByLabel("Option 3");
group.assertValue("Option 3");
Pre-selected Value
RadioButtonGroupElement group = RadioButtonGroupElement.getByLabel(page, "Pre-selected Value");
group.assertVisible();
group.assertValue("Option 2");
Disabled State
RadioButtonGroupElement group = RadioButtonGroupElement.getByLabel(page, "Disabled RadioButtonGroup");
group.assertVisible();
group.assertDisabled();
Helper Text
RadioButtonGroupElement group = RadioButtonGroupElement.getByLabel(page, "Helper Text");
group.assertVisible();
group.assertHelperHasText("This is a helper text");