public ElementTree FindInTreeIMP(String name, ControlType controlType, String[] ancestorList) { ofl.AddLine("Scanning element \"" + current.Current.Name + "\" - " + current.Current.ControlType.LocalizedControlType); Boolean found = CompareElements(name, controlType, ancestorList); if (found) { return(this); } foreach (ElementTree child in children) { ElementTree res = child.FindInTreeIMP(name, controlType, ancestorList); if (res != null) { return(res); } } return(null); }
public ElementTree FindInTree(String name, ControlType controlType, String[] ancestorList) { String ct = "IGNORE"; if (controlType != null) { ct = controlType.LocalizedControlType.ToString(); } ofl.AddLine("Scanning for \"" + name + "\" - " + " Control Type: " + ct); ElementTree res = FindInTreeIMP(name, controlType, ancestorList); if (res != null) { ofl.AddLine("Success! Found element \"" + res.GetName() + "\" - " + res.GetAutomationElement().Current.ControlType.LocalizedControlType); } else { ofl.AddLine("Error! No matching element found."); } return(res); }