Skip to content

Commit

Permalink
Added some convenience properties to the AutomationElement.
Browse files Browse the repository at this point in the history
  • Loading branch information
Roemer committed Jun 25, 2017
1 parent 4901a3b commit 450d7c7
Showing 1 changed file with 42 additions and 10 deletions.
Expand Up @@ -52,6 +52,32 @@ public AutomationElement(AutomationElement automationElement)
/// </summary>
public ConditionFactory ConditionFactory => BasicAutomationElement.Automation.ConditionFactory;

/// <summary>
/// The current <see cref="AutomationType" /> for this element.
/// </summary>
public AutomationType AutomationType => BasicAutomationElement.Automation.AutomationType;

/// <summary>
/// Standard UIA patterns of this element.
/// </summary>
public AutomationElementPatternValuesBase Patterns => BasicAutomationElement.Patterns;

/// <summary>
/// Standard UIA properties of this element.
/// </summary>
public AutomationElementPropertyValues Properties => BasicAutomationElement.Properties;

/// <summary>
/// Gets the cached children for this element.
/// </summary>
public AutomationElement[] CachedChildren => BasicAutomationElement.GetCachedChildren();

/// <summary>
/// Gets the cached parent for this element.
/// </summary>
public AutomationElement CachedParent => BasicAutomationElement.GetCachedParent();

#region Convenience properties
/// <summary>
/// The direct framework type of the element.
/// Results in "FrameworkType.Unknown" if it couldn't be resolved.
Expand All @@ -67,29 +93,35 @@ public FrameworkType FrameworkType
}

/// <summary>
/// The current <see cref="AutomationType" /> for this element.
/// The automation id of the element.
/// </summary>
public AutomationType AutomationType => BasicAutomationElement.Automation.AutomationType;
public string AutomationId => Properties.AutomationId.Value;

/// <summary>
/// Standard UIA patterns of this element.
/// The name of the element.
/// </summary>
public AutomationElementPatternValuesBase Patterns => BasicAutomationElement.Patterns;
public string Name => Properties.Name.Value;

/// <summary>
/// Standard UIA properties of this element.
/// The class name of the element.
/// </summary>
public AutomationElementPropertyValues Properties => BasicAutomationElement.Properties;
public string ClassName => Properties.ClassName.Value;

/// <summary>
/// Gets the cached children for this element.
/// The control type of the element.
/// </summary>
public AutomationElement[] CachedChildren => BasicAutomationElement.GetCachedChildren();
public ControlType ControlType => Properties.ControlType.Value;

/// <summary>
/// Gets the cached parent for this element.
/// Flag if the element is enabled or not.
/// </summary>
public AutomationElement CachedParent => BasicAutomationElement.GetCachedParent();
public bool IsEnabled => Properties.IsEnabled.Value;

/// <summary>
/// Flag if the element off-screen or on-screen(visible).
/// </summary>
public bool IsOffscreen => Properties.IsOffscreen.Value;
#endregion Convenience properties

/// <summary>
/// Performs a left click on the element.
Expand Down

0 comments on commit 450d7c7

Please sign in to comment.