public FindFirst ( TreeScope scope, Condition condition ) : |
||
scope | TreeScope | |
condition | Condition | |
return |
AutomationElement mainWindow = AutomationElement.RootElement.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "Window Name")); AutomationElement buttonElement = mainWindow.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.NameProperty, "Button Name"));
AutomationElement listContainer = AutomationElement.RootElement.FindFirst(TreeScope.Children, new PropertyCondition(AutomationElement.AutomationIdProperty, "ContainerId")); AutomationElement listElement = listContainer.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.List));These examples demonstrate how to use the FindFirst method to locate elements based on common attributes such as name, ID, and control type. The package library used by this method is the System.Windows.Automation library, which is part of the .NET Framework.
public FindFirst ( TreeScope scope, Condition condition ) : |
||
scope | TreeScope | |
condition | Condition | |
return |