private static void MatchElement(AutomationElement current, AutomationSearchCondition automationSearchCondition, ElementSearchResult elementSearchResult) { WhiteLogger.Instance.DebugFormat("[RawSearch] Matching: ({0})", current.Display()); if (automationSearchCondition.Satisfies(current)) { WhiteLogger.Instance.DebugFormat("[RawSearch] Matched: ({0})", current.Display()); elementSearchResult.Add(current); } }
private void FindMatchingDescendants(AutomationElement element, AutomationSearchCondition automationSearchCondition, ElementSearchResult elementSearchResult, int depth) { if (depth == 0) { return; } logger.DebugFormat("[RawSearch] Finding descendants of: ({0})", element.Display()); AutomationElement current = RawViewWalker.GetFirstChild(element); while (current != null) { MatchElement(current, automationSearchCondition, elementSearchResult); if (elementSearchResult.AllResultsFound) return; FindMatchingDescendants(current, automationSearchCondition, elementSearchResult, depth - 1); if (elementSearchResult.AllResultsFound) return; current = RawViewWalker.GetNextSibling(current); } }