public Queue <AutomationElement> GetRootInit() { Queue <AutomationElement> aeQueue = new Queue <AutomationElement>(); //System.Windows.Automation.Condition conditions = new PropertyCondition(AutomationElement.IsEnabledProperty, true); //Condition conditions = new PropertyCondition(AutomationElement.IsEnabledProperty, true); System.Windows.Automation.Condition conditions = System.Windows.Automation.Condition.TrueCondition; AutomationElement root = AutomationElement.RootElement; AutomationElementCollection aec = root.FindAll(TreeScope.Children, conditions); foreach (AutomationElement ae in aec) { aeQueue.Enqueue(ae); } /* * Process[] allProcesses = Process.GetProcesses(); * foreach (Process proc in allProcesses) * { * System.Windows.Automation.Condition tempCondition = new PropertyCondition(AutomationElement.ProcessIdProperty, proc.Id); * AutomationElement ae = AutomationElement.RootElement.FindFirst(TreeScope.Element | TreeScope.Children, tempCondition); * if (ae != null) * aeQueue.Enqueue(ae); * } */ return(aeQueue); }
internal static IEnumerable <AutomationElement> FindAll( AutomationElement parent, TreeScope scope, Condition condition) { return(FindAll(parent, scope, condition, FindTimeout)); }
private System.Windows.Automation.Condition BuildSearchCondition(XmlNode xnUIAObject) { System.Windows.Automation.Condition trueCondition = null; XmlNode xnPropCondition = xnUIAObject.SelectSingleNode("PropertyCondition"); XmlNode xnAndCondition = xnUIAObject.SelectSingleNode("AndCondition"); XmlNode xnOrCondition = xnUIAObject.SelectSingleNode("OrCondition"); XmlNode xnNotCondition = xnUIAObject.SelectSingleNode("NotCondition"); if (xnPropCondition != null) { trueCondition = this.BuildPropertyCondition(xnPropCondition); } else if (xnAndCondition != null) { trueCondition = this.BuildAndCondition(xnAndCondition); } else if (xnOrCondition != null) { trueCondition = this.BuildOrCondition(xnOrCondition); } else if (xnNotCondition != null) { trueCondition = this.BuildNotCondition(xnNotCondition); } if (trueCondition == null) { trueCondition = System.Windows.Automation.Condition.TrueCondition; } return(trueCondition); }
internal static IEnumerable<AutomationElement> FindAll( AutomationElement parent, TreeScope scope, Condition condition) { return FindAll(parent, scope, condition, FindTimeout); }
private System.Windows.Automation.Condition BuildNotCondition(XmlNode xnNotCondition) { NotCondition condition = null; XmlNode xnPropCondition = xnNotCondition.SelectSingleNode("PropertyCondition"); XmlNode node2 = xnNotCondition.SelectSingleNode("AndCondition"); XmlNode node3 = xnNotCondition.SelectSingleNode("OrCondition"); if (xnPropCondition != null) { System.Windows.Automation.Condition condition2 = this.BuildPropertyCondition(xnPropCondition); if (condition2 != null) { condition = new NotCondition(condition2); } return(condition); } if (node2 != null) { System.Windows.Automation.Condition condition3 = this.BuildAndCondition(xnPropCondition); if (condition3 != null) { condition = new NotCondition(condition3); } return(condition); } if (node3 != null) { System.Windows.Automation.Condition condition4 = this.BuildOrCondition(xnPropCondition); if (condition4 != null) { condition = new NotCondition(condition4); } } return(condition); }
public void ControlViewConditionTest() { SWA.Condition controlViewCond = SWA.Automation.ControlViewCondition; Assert.IsNotNull(controlViewCond, "ControlViewCondition"); SWA.PropertyCondition controlViewPropCond = controlViewCond as SWA.PropertyCondition; Assert.IsNull(controlViewPropCond, "ControlViewCondition is not a PropertyCondition"); SWA.AndCondition controlViewAndCond = controlViewCond as SWA.AndCondition; Assert.IsNull(controlViewAndCond, "ControlViewCondition is not a AndCondition"); SWA.OrCondition controlViewOrCond = controlViewCond as SWA.OrCondition; Assert.IsNull(controlViewOrCond, "ControlViewCondition is not a OrCondition"); SWA.NotCondition controlViewNotCond = controlViewCond as SWA.NotCondition; Assert.IsNotNull(controlViewNotCond, "ControlViewCondition is a NotCondition"); SWA.Condition subCond = controlViewNotCond.Condition; Assert.IsNotNull(subCond, "ControlViewCondition.Condition"); SWA.PropertyCondition subPropertyCond = subCond as SWA.PropertyCondition; Assert.IsNotNull(subPropertyCond, "ControlViewCondition.Condition is a PropertyCondition"); Assert.AreEqual(AEIds.IsControlElementProperty, subPropertyCond.Property, "ControlViewCondition.Condition.Property"); Assert.AreEqual(false, subPropertyCond.Value, "ControlViewCondition.Condition.Value"); Assert.AreEqual(SWA.PropertyConditionFlags.None, subPropertyCond.Flags, "ControlViewCondition.Condition.Flags"); }
public Menu InvokeContextMenu(Condition condition) { var mouse = new Mouse(); mouse.RightClick(this); return new Window(AutomationElement.RootElement, "Desktop").Find<Menu>(condition); }
protected AutomationElement FindUIAControl(XmlNode control) { string controlName = GetAttributeValue(control, "name", ""); AutomationElement rootAutomationElement = this.RootAutomationElement; if (control != null) { System.Windows.Automation.Condition condition = null; int result = 1; int num2 = 1; XmlAttribute xmlAttribute = UIAHelperMethods.GetXmlAttribute(control, "StartFromDesktop"); if ((xmlAttribute != null) && (xmlAttribute.Value != null)) { bool flag = true; if (xmlAttribute.Value == flag.ToString()) { rootAutomationElement = AutomationElement.RootElement; } } XmlNode xnPropCondition = control.SelectSingleNode("UIObject"); if (xnPropCondition == null) { return(rootAutomationElement); } do { XmlAttribute attribute2 = UIAHelperMethods.GetXmlAttribute(xnPropCondition, "MatchCount"); if ((attribute2 != null) && (attribute2.Value != null)) { int.TryParse(attribute2.Value, out result); } condition = this.BuildSearchCondition(xnPropCondition); if (result == 1) { rootAutomationElement = rootAutomationElement.FindFirst(TreeScope.Children, condition); } else { AutomationElementCollection elements = rootAutomationElement.FindAll(TreeScope.Children, condition); if ((result <= elements.Count) && (result > 0)) { rootAutomationElement = elements[result - 1]; } else { throw new DataDrivenAdapterException(OperationType.FindControl, controlName, "DDA0400_UNABLE_TO_FIND_CONTROL_ON_UI" + string.Format(CultureInfo.CurrentUICulture, "FIND_ERROR_LEVEL", new object[] { num2.ToString(CultureInfo.InvariantCulture) })); } } if (rootAutomationElement == null) { throw new DataDrivenAdapterException(OperationType.FindControl, controlName, "DDA0400_UNABLE_TO_FIND_CONTROL_ON_UI" + string.Format(CultureInfo.CurrentUICulture, "FIND_ERROR_LEVEL", new object[] { num2.ToString(CultureInfo.InvariantCulture) })); } xnPropCondition = xnPropCondition.SelectSingleNode("UIObject"); num2++; }while (xnPropCondition != null); } return(rootAutomationElement); }
public Menu InvokeContextMenu(Condition condition) { var mouse = new Mouse(); mouse.RightClick(this); return(new Window(AutomationElement.RootElement, "Desktop").Find <Menu>(condition)); }
public static List<IUiElement> GetResultList_ExactSearch(IUiElement element, Condition conditions, Hashtable[] searchCriteria) { var resultListOfControls = ControlSearcher.SearchByExactConditionsViaUia( element, searchCriteria, conditions); return resultListOfControls; }
/// <summary> /// Finds all elements in the given tree scope and with the given condition within the given timeout. /// </summary> public bool TryFindAll(TreeScope treeScope, System.Windows.Automation.Condition condition, TimeSpan timeOut, [NotNullWhen(true)] out IReadOnlyList <UiElement>?result) { if (condition is null) { throw new ArgumentNullException(nameof(condition)); } return(this.TryFindAll(treeScope, condition, FromAutomationElement, timeOut, out result)); }
/// <summary> /// Finds all elements in the given tree scope and with the given condition within the given timeout. /// </summary> public IReadOnlyList <UiElement> FindAll(TreeScope treeScope, System.Windows.Automation.Condition condition, TimeSpan timeOut) { if (this.TryFindAll(treeScope, condition, timeOut, out var result)) { return(result); } throw new InvalidOperationException($"Did not find an element matching {condition}."); }
/// <summary> /// Finds the first element which is in the given treescope with the given condition within the given timeout period. /// </summary> public UiElement FindAt(TreeScope treeScope, System.Windows.Automation.Condition condition, int index, TimeSpan timeOut) { if (this.TryFindAt(treeScope, condition, index, timeOut, out var result)) { return(result); } throw new InvalidOperationException($"Did not find an element matching {condition.Description()} at index {index}."); }
/// <summary> /// Finds the first element which is in the given treescope with the given condition within the given timeout period. /// </summary> public T FindFirst <T>(TreeScope treeScope, System.Windows.Automation.Condition condition, Func <AutomationElement, T> wrap, TimeSpan timeOut) where T : UiElement { if (this.TryFindFirst(treeScope, condition, wrap, timeOut, out var result)) { return(result); } throw new InvalidOperationException($"Did not find a {typeof(T).Name} matching {condition.Description()}."); }
public static List<IUiElement> GetResultList_ViaWildcards(IUiElement element, Condition condition, ControlSearcherData data) { List<IUiElement> resultList = ControlSearcher.SearchByWildcardOrRegexViaUia( element, data, condition, true); return resultList; }
public System.Windows.Automation.Condition CreateCondition(System.Windows.Automation.Condition controlTypeCondition, string name) { if (name == null) { return(controlTypeCondition); } return(new AndCondition( controlTypeCondition, Conditions.ByNameOrAutomationId(name))); }
public void ContentViewConditionTest() { SWA.Condition contentViewCond = SWA.Automation.ContentViewCondition; Assert.IsNotNull(contentViewCond, "ContentViewCondition"); SWA.PropertyCondition contentViewPropCond = contentViewCond as SWA.PropertyCondition; Assert.IsNull(contentViewPropCond, "ContentViewCondition is not a PropertyCondition"); SWA.AndCondition contentViewAndCond = contentViewCond as SWA.AndCondition; Assert.IsNull(contentViewPropCond, "ContentViewCondition is not a PropertyCondition"); Assert.IsNull(contentViewAndCond, "ContentViewCondition is not a AndCondition"); SWA.OrCondition contentViewOrCond = contentViewCond as SWA.OrCondition; Assert.IsNull(contentViewOrCond, "ContentViewCondition is not a OrCondition"); SWA.NotCondition contentViewNotCond = contentViewCond as SWA.NotCondition; Assert.IsNotNull(contentViewNotCond, "ContentViewCondition is a NotCondition"); SWA.Condition subCond = contentViewNotCond.Condition; Assert.IsNotNull(subCond, "ContentViewCondition.Condition"); SWA.OrCondition subOrCond = subCond as SWA.OrCondition; Assert.IsNotNull(subOrCond, "ContentViewCondition.Condition is a OrCondition"); SWA.Condition [] subSubConditions = subOrCond.GetConditions(); Assert.AreEqual(2, subSubConditions.Length, "ContentViewCondition.Condition.GetConditions length"); SWA.PropertyCondition subSubPropertyCond1 = subSubConditions [0] as SWA.PropertyCondition; Assert.IsNotNull(subSubPropertyCond1); SWA.PropertyCondition subSubPropertyCond2 = subSubConditions [1] as SWA.PropertyCondition; Assert.IsNotNull(subSubPropertyCond2); Assert.AreEqual(AEIds.IsControlElementProperty, subSubPropertyCond1.Property, "subcondition1 Property"); Assert.AreEqual(false, subSubPropertyCond1.Value, "subcondition1 Value"); Assert.AreEqual(SWA.PropertyConditionFlags.None, subSubPropertyCond1.Flags, "subcondition1 Flags"); Assert.AreEqual(AEIds.IsContentElementProperty.ProgrammaticName, subSubPropertyCond2.Property.ProgrammaticName, "subcondition2 Property"); Assert.AreEqual(false, subSubPropertyCond2.Value, "subcondition2 Value"); Assert.AreEqual(SWA.PropertyConditionFlags.None, subSubPropertyCond2.Flags, "subcondition2 Flags"); }
public static List<IUiElement> GetResultList_ViaWildcards_Legacy(IUiElement element, Condition condition, ControlSearcherData data) { var cmdletDerived = new GetControlCollectionCmdletBase(); List<IUiElement> resultList = cmdletDerived.GetAutomationElementsWithFindAll( element, data, condition, false, false, false, true); return resultList; }
public void RawViewConditionTest() { SWA.Condition rawViewCond = SWA.Automation.RawViewCondition; Assert.IsNotNull(rawViewCond, "RawViewCondition"); SWA.PropertyCondition rawViewPropCond = rawViewCond as SWA.PropertyCondition; Assert.IsNull(rawViewPropCond, "RawViewCondition is not a PropertyCondition"); SWA.AndCondition rawViewAndCond = rawViewCond as SWA.AndCondition; Assert.IsNull(rawViewAndCond, "RawViewCondition is not a AndCondition"); SWA.OrCondition rawViewOrCond = rawViewCond as SWA.OrCondition; Assert.IsNull(rawViewOrCond, "RawViewCondition is not a OrCondition"); SWA.NotCondition rawViewNotCond = rawViewCond as SWA.NotCondition; Assert.IsNull(rawViewNotCond, "RawViewCondition is not a NotCondition"); }
/// <summary> /// Finds the first element which is in the given treescope with the given condition within the given timeout period. /// </summary> public bool TryFindAt(TreeScope treeScope, System.Windows.Automation.Condition condition, int index, TimeSpan timeOut, out UiElement result) { result = null; var start = DateTime.Now; while (!Retry.IsTimeouted(start, timeOut)) { result = this.AutomationElement.FindIndexed(treeScope, condition, index, FromAutomationElement); if (result != null) { return(true); } Wait.For(Retry.PollInterval); } return(result != null); }
private System.Windows.Automation.Condition BuildPropertyCondition(XmlNode xnPropCondition) { System.Windows.Automation.Condition condition = null; PropertyConditionFlags none = PropertyConditionFlags.None; string str = string.Empty; if (xnPropCondition.InnerText == null) { return(condition); } str = UIAHelperMethods.GetXmlAttribute(xnPropCondition, "Name").Value; Type type = AutomationPropReturnTypes[str]; if (type.Equals(typeof(string))) { none = PropertyConditionFlags.IgnoreCase; } return(new PropertyCondition(AutomationProperties[str], this.ConvertStringtoObject(xnPropCondition.InnerText, AutomationPropReturnTypes[str]), none)); }
/// <summary> /// Finds the first element which is in the given treescope with the given condition within the given timeout period. /// </summary> public bool TryFindAt <T>(TreeScope treeScope, System.Windows.Automation.Condition condition, int index, Func <AutomationElement, T> wrap, TimeSpan timeOut, out T result) where T : UiElement { result = null; var start = DateTime.Now; while (!Retry.IsTimeouted(start, timeOut)) { if (this.AutomationElement.TryFindIndexed(treeScope, condition, index, out var element)) { result = wrap(element); return(true); } Wait.For(Retry.PollInterval); } return(result != null); }
/// <summary> /// Finds all elements in the given treescope and with the given condition within the given timeout. /// </summary> public bool TryFindAll <T>(TreeScope treeScope, System.Windows.Automation.Condition condition, Func <AutomationElement, T> wrap, TimeSpan timeOut, out IReadOnlyList <T> result) where T : UiElement { result = null; var start = DateTime.Now; while (!Retry.IsTimeouted(start, timeOut)) { result = this.AutomationElement.FindAll(treeScope, condition, wrap); if (result != null && result.Count > 0) { return(true); } Wait.For(Retry.PollInterval); } return(result != null); }
internal static AutomationElement FindFirst( AutomationElement parent, TreeScope scope, Condition condition, int timeout) { var dtn = DateTime.Now.AddMilliseconds(timeout); // ReSharper disable once LoopVariableIsNeverChangedInsideLoop while (DateTime.Now <= dtn) { var element = parent.FindFirst(scope, condition); if (element != null) { return element; } } return null; }
internal static IEnumerable<AutomationElement> FindAll( AutomationElement parent, TreeScope scope, Condition condition, int timeout) { var dtn = DateTime.Now.AddMilliseconds(timeout); // ReSharper disable once LoopVariableIsNeverChangedInsideLoop while (DateTime.Now <= dtn) { var elements = parent.FindAll(scope, condition); if (elements.Count > 0) { return elements.Cast<AutomationElement>(); } } return Enumerable.Empty<AutomationElement>(); }
public ATS GetElements(string TreeScope = null, string Name = null, string AutomationId = null, string ClassName = null, string FrameworkId = null, string ControlType = null) { try { System.Windows.Automation.TreeScope treeScope = GetTreeScope(TreeScope); System.Windows.Automation.Condition condition = GetCondition(Name, AutomationId, ClassName, FrameworkId, ControlType); me = me == null ? AutomationElement.RootElement : me; AutomationElementCollection aec = me.FindAll(treeScope, condition); AT[] at = new AT[aec.Count]; for (int i = 0; i < aec.Count; i++) { at[i] = new AT(aec[i]); } return(new ATS(at)); } catch (Exception ex) { throw new Exception("GetElements error. " + ex.Message); } }
/// <summary> /// Finds all elements in the given tree scope and with the given condition within the given timeout. /// </summary> public bool TryFindAll <T>(TreeScope treeScope, System.Windows.Automation.Condition condition, Func <AutomationElement, T> wrap, TimeSpan timeOut, [NotNullWhen(true)] out IReadOnlyList <T>?result) where T : UiElement { if (condition is null) { throw new ArgumentNullException(nameof(condition)); } if (wrap is null) { throw new ArgumentNullException(nameof(wrap)); } result = null; var start = DateTime.Now; while (!Retry.IsTimeouted(start, timeOut)) { result = this.AutomationElement.FindAll(treeScope, condition, wrap); if (result is { } &&
internal static AutomationElement FindFirst( AutomationElement parent, TreeScope scope, Condition condition, int timeout) { var dtn = DateTime.Now.AddMilliseconds(timeout); // ReSharper disable once LoopVariableIsNeverChangedInsideLoop while (DateTime.Now <= dtn) { var element = parent.FindFirst(scope, condition); if (element != null) { return(element); } } return(null); }
internal static IEnumerable <AutomationElement> FindAll( AutomationElement parent, TreeScope scope, Condition condition, int timeout) { var dtn = DateTime.Now.AddMilliseconds(timeout); // ReSharper disable once LoopVariableIsNeverChangedInsideLoop while (DateTime.Now <= dtn) { var elements = parent.FindAll(scope, condition); if (elements.Count > 0) { return(elements.Cast <AutomationElement>()); } } return(Enumerable.Empty <AutomationElement>()); }
private System.Windows.Automation.Condition BuildOrCondition(XmlNode xnOrCondition) { System.Windows.Automation.Condition item = null; List <System.Windows.Automation.Condition> list = new List <System.Windows.Automation.Condition>(); foreach (XmlNode node in xnOrCondition.SelectNodes("PropertyCondition")) { item = this.BuildPropertyCondition(node); if (item != null) { list.Add(item); } } foreach (XmlNode node2 in xnOrCondition.SelectNodes("AndCondition")) { item = this.BuildAndCondition(node2); if (item != null) { list.Add(item); } } foreach (XmlNode node3 in xnOrCondition.SelectNodes("OrCondition")) { item = this.BuildOrCondition(node3); if (item != null) { list.Add(item); } } foreach (XmlNode node4 in xnOrCondition.SelectNodes("NotCondition")) { item = this.BuildNotCondition(node4); if (item != null) { list.Add(item); } } return(new OrCondition(list.ToArray())); }
public AT GetElement(string TreeScope = null, string Name = null, string AutomationId = null, string ClassName = null, string FrameworkId = null, string ControlType = null, string Index = null, string Timeout = null, string IsEnabled = null) { try { AT atObj = null; this.me = (this.me == null) ? AutomationElement.RootElement : this.me; System.Windows.Automation.TreeScope treeScope = GetTreeScope(TreeScope); System.Windows.Automation.Condition condition = GetCondition(Name, AutomationId, ClassName, FrameworkId, ControlType); if (WaitProcessEventDelegate != null && !String.IsNullOrEmpty(Timeout)) { Timeout = null; } AT.Ele.me = me; AT.Ele.condition = condition; AT.Ele.treeScope = treeScope; AT.Ele.Name = Name; AT.Ele.AutomationId = AutomationId; AT.Ele.ClassName = ClassName; AT.Ele.Index = Index; if (String.IsNullOrEmpty(Timeout)) { atObj = this.GetElementHandle(); } else { WaitProcessEventDelegate += new AT.WaitProcessDelegateHandler(EventDo_GetElementTimeout); atObj = GetElementAndWaitProcess(new AT(), Timeout); } if (!String.IsNullOrEmpty(IsEnabled)) { if (!(atObj.GetElementInfo().IsEnabled())) { throw new Exception("Not Enabled. "); } } return(atObj); } catch (Exception ex) { throw new Exception("GetElement error. " + ex.Message); } }
internal static AutomationElement FindFirst(AutomationElement parent, TreeScope scope, Condition condition) { return(FindFirst(parent, scope, condition, CruciatusFactory.Settings.SearchTimeout)); }
/// <summary> /// Applies the active binary operator to the specified conditions. /// </summary> /// <param name="left">The left hand condition.</param> /// <param name="right">The right hand condition.</param> /// <returns>The new condition after the operator is applied.</returns> private Condition JoinWithBinaryOperator(Condition left, Condition right) { return BinaryOperator == null ? Util.Operators.And.Join(left, right) : BinaryOperator.Join(left, right); }
internal static AutomationElement FindFirst(AutomationElement parent, TreeScope scope, Condition condition) { return FindFirst(parent, scope, condition, FindTimeout); }
/// <summary> /// Finds all elements in the given tree scope and with the given condition. /// </summary> public IReadOnlyList <T> FindAll <T>(TreeScope treeScope, System.Windows.Automation.Condition condition, Func <AutomationElement, T> wrap) where T : UiElement { return(this.AutomationElement.FindAll(treeScope, condition, wrap)); }
public virtual AutomationElement Descendant(Condition condition) { return DescendantFinderFactory.Create(automationElement).Descendant(condition); }
public virtual AutomationElement Descendant(Condition condition) { return Descendant(new AutomationSearchCondition(condition)); }
/// <summary> /// Joins the two conditions using an OrCondition. /// </summary> /// <param name="left">The left hand condition.</param> /// <param name="right">The right hand condition.</param> /// <returns>The new condition.</returns> public Condition Join(Condition left, Condition right) { return new OrCondition(left, right); }
private static List <MeasurementResult> FindCandidatesInGroup(DirectionFunction function, Rect focusedBounds, AutomationElement group, System.Windows.Automation.Condition condition) { var results = new List <MeasurementResult>(); var children = group.FindAll(TreeScope.Children, condition)?.Cast <AutomationElement>(); if (children == null) { return(results); } AutomationElement candidate = null; double nearestItemDistance = double.PositiveInfinity; foreach (var element in children) { var info = element.Current; var targetBounds = info.BoundingRectangle; var controlType = info.ControlType; if (controlType == ControlType.TreeItem) { results.AddRange(FindCandidatesInGroup(function, focusedBounds, element, condition)); } if (_ignoreElements.Contains(controlType) || targetBounds == focusedBounds || !function.IsInDirection(targetBounds, focusedBounds) || info.IsOffscreen) { continue; } var distance = function.DistanceCaluculator(targetBounds, focusedBounds, _weightingValue); if (!IsFocusable(info, controlType) || targetBounds == _zero) { distance = double.PositiveInfinity; } if (distance < nearestItemDistance && _enumerateTargets.Contains(controlType)) { nearestItemDistance = distance; candidate = element; } else { results.AddRange(FindCandidatesInGroup(function, focusedBounds, element, condition)); } } if (candidate == null) { return(results); } results.Add(new MeasurementResult(candidate, nearestItemDistance)); return(results); }
public virtual AutomationElement Descendant(Condition condition) { return automationElement.FindFirst(TreeScope.Descendants, condition); }
public IReadOnlyList <UiElement> FindAllDescendants(System.Windows.Automation.Condition condition) { return(this.FindAll(TreeScope.Descendants, condition)); }
internal static AutomationElement FindFirst(AutomationElement parent, TreeScope scope, Condition condition) { return FindFirst(parent, scope, condition, CruciatusFactory.Settings.SearchTimeout); }
internal static AutomationElement FindFirst(AutomationElement parent, TreeScope scope, Condition condition) { return(FindFirst(parent, scope, condition, FindTimeout)); }
/// <summary> /// Finds all elements in the given tree scope and with the given condition. /// </summary> public IReadOnlyList <UiElement> FindAll(TreeScope treeScope, System.Windows.Automation.Condition condition) { return(this.AutomationElement.FindAll(treeScope, condition, FromAutomationElement)); }
/// <summary> /// Applies the specified property condition to this query. /// </summary> /// <param name="condition">The condition to apply.</param> internal void ApplyCondition(Condition condition) { // Apply the active unary condition. condition = ApplyUnaryOperator(condition); // If the current active condition is null, not need to apply the binary operator. // If it isn't null, apply the binary operator. if (Query.Conditions == null) Query.Conditions = condition; else Query.Conditions = JoinWithBinaryOperator(Query.Conditions, condition); // Reset the operators for the next condition. UnaryOperator = null; BinaryOperator = null; }
public static List<IUiElement> GetResultList_TextSearch(IUiElement element, Condition conditions) { var resultListOfControls = ControlSearcher.SearchByContainsTextViaUia(element, conditions); return resultListOfControls; }
/// <summary> /// Applies the active unary operator to the specified condition. /// </summary> /// <param name="condition">The condition.</param> /// <returns>The new condition after the operator is applied.</returns> private Condition ApplyUnaryOperator(Condition condition) { return UnaryOperator == null ? condition : UnaryOperator.Apply(condition); }
/// <summary> /// Applies the "not" operator on this condition and returns a new condition. /// </summary> /// <param name="condition">The condition to apply the operator on.</param> /// <returns>The "not" condition.</returns> public Condition Apply(Condition condition) { return new NotCondition(condition); }
public bool Matches(AutomationElement element, Condition condition) { return new TreeWalker(condition).Normalize(element) != null; }