Represents the radio button control (<input type="radio">). Default search is performed by the label.

Inherited from Field.

Syntax

[ControlDefinition("input[@type='radio']", IgnoreNameEndings = "RadioButton,Radio,Button,Option")]
[ControlFinding(FindTermBy.Label)]
public class RadioButton<TOwner> : Field<bool, TOwner>, ICheckable<TOwner>
    where TOwner : PageObject<TOwner>

Properties

public DataProvider<bool, TOwner>

IsChecked { get; }

Gets the DataProvider<bool, TOwner> instance of the checked state value.

Methods

public TOwner

Check()

Checks the control. Also executes TriggerEvents.BeforeClick and TriggerEvents.AfterClick triggers.

Example

<label class="radio-inline">
  <input type="radio" name="radios" id="radio1"
         value="option1" checked> Option 1
</label>
<label class="radio-inline">
  <input type="radio" name="radios" id="radio2"
         value="option2"> Option 2
</label>
using Atata;

namespace SampleApp.UITests
{
    using _ = SamplePage;

    public class SamplePage : Page<_>
    {
        [FindById(TermCase.LowerMerged)]
        public RadioButton<_> Option1 { get; private set; }

        [FindById(TermCase.LowerMerged)]
        public RadioButton<_> Option2 { get; private set; }
    }
}
Go.To<SamplePage>().
    Option1.Should.BeChecked().
    Option2.Check().
    Option1.Should.BeUnchecked().
    Option2.Should.BeChecked();