/
RadioButton.cs
72 lines (66 loc) · 2.28 KB
/
RadioButton.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
namespace Legerity.Windows.Elements.Core;
using Legerity.Windows.Extensions;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Windows;
using OpenQA.Selenium.Remote;
/// <summary>
/// Defines a <see cref="WindowsElement"/> wrapper for the core UWP RadioButton control.
/// </summary>
public class RadioButton : Button
{
/// <summary>
/// Initializes a new instance of the <see cref="RadioButton"/> class.
/// </summary>
/// <param name="element">
/// The <see cref="WindowsElement"/> reference.
/// </param>
public RadioButton(WindowsElement element)
: base(element)
{
}
/// <summary>
/// Gets a value indicating whether the radio button is selected.
/// </summary>
/// <exception cref="StaleElementReferenceException">Thrown when an element is no longer valid in the document DOM.</exception>
public virtual bool IsSelected => this.IsSelected();
/// <summary>
/// Allows conversion of a <see cref="WindowsElement"/> to the <see cref="RadioButton"/> without direct casting.
/// </summary>
/// <param name="element">
/// The <see cref="WindowsElement"/>.
/// </param>
/// <returns>
/// The <see cref="RadioButton"/>.
/// </returns>
public static implicit operator RadioButton(WindowsElement element)
{
return new RadioButton(element);
}
/// <summary>
/// Allows conversion of a <see cref="AppiumWebElement"/> to the <see cref="RadioButton"/> without direct casting.
/// </summary>
/// <param name="element">
/// The <see cref="AppiumWebElement"/>.
/// </param>
/// <returns>
/// The <see cref="RadioButton"/>.
/// </returns>
public static implicit operator RadioButton(AppiumWebElement element)
{
return new RadioButton(element as WindowsElement);
}
/// <summary>
/// Allows conversion of a <see cref="RemoteWebElement"/> to the <see cref="RadioButton"/> without direct casting.
/// </summary>
/// <param name="element">
/// The <see cref="RemoteWebElement"/>.
/// </param>
/// <returns>
/// The <see cref="RadioButton"/>.
/// </returns>
public static implicit operator RadioButton(RemoteWebElement element)
{
return new RadioButton(element as WindowsElement);
}
}