A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
883 B

using System;
using System.Runtime.InteropServices;
using OpenQA.Selenium.Appium;
namespace Avalonia.IntegrationTests.Win32
{
internal static class ElementExtensions
{
public static string GetName(this AppiumWebElement element) => GetAttribute(element, "Name", "title");
public static bool? GetIsChecked(this AppiumWebElement element) =>
GetAttribute(element, "Toggle.ToggleState", "value") switch
{
"0" => false,
"1" => true,
"2" => null,
_ => throw new ArgumentOutOfRangeException($"Unexpected IsChecked value.")
};
public static string GetAttribute(AppiumWebElement element, string windows, string macOS)
{
return element.GetAttribute(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? windows : macOS);
}
}
}