Represents the radio button list control (a set of <input type="radio">). Default search is performed by the name. Specific radio button items can be found by label or value. By default items are searched by label using FindItemByLabelAttribute. Use FindItemByValueAttribute to find items by value. As a data type supports enum, string, numeric and other types.

Inherited from EditableField.

Supports [FindItemByLabel], [FindItemByValue], [Format] and [Culture] settings attributes.

Syntax

[ControlDefinition("input[@type='radio']", IgnoreNameEndings = "RadioButtons,RadioButtonList,Radios,RadioGroup,Buttons,ButtonList,Options,OptionGroup")]
[ControlFinding(FindTermBy.Name)]
public class RadioButtonList<T, TOwner> : OptionList<T, TOwner>
    where TOwner : PageObject<TOwner>

Example #1: Using Enum

<label class="radio-inline">
    <input type="radio" name="options" value="OptionA">
    Option A
</label>
<label class="radio-inline">
    <input type="radio" name="options" value="OptionB">
    Option B
</label>
<label class="radio-inline">
    <input type="radio" name="options" value="OptionC">
    Option C
</label>
public enum SomeOption
{
    OptionA,
    OptionB,
    OptionC
}
using Atata;

namespace SampleApp.UITests
{
    using _ = SamplePage;

    public class SamplePage : Page<_>
    {
        [FindByName]
        public RadioButtonList<SomeOption?, _> Options { get; private set; }
    }
}
Go.To<SamplePage>().
    Options.Should.Equal(null).
    Options.Set(SomeOptions.OptionB).
    Options.Should.Equal(SomeOptions.OptionB);

Example #2: Using String

<label class="radio-inline">
    <input type="radio" name="options" value="OptionA">
    Option A
</label>
<label class="radio-inline">
    <input type="radio" name="options" value="OptionB">
    Option B
</label>
<label class="radio-inline">
    <input type="radio" name="options" value="OptionC">
    Option C
</label>
using Atata;

namespace SampleApp.UITests
{
    using _ = SamplePage;

    public class SamplePage : Page<_>
    {
        [FindByName]
        [FindItemByValue]
        public RadioButtonList<string, _> Options { get; private set; }
    }
}
Go.To<SamplePage>().
    Options.Should.Equal(null).
    Options.Set("OptionB").
    Options.Should.Equal("OptionB");