/// <summary> /// Retrieves a White element using RawElementBasedSearch with the given MaxElementSearchDepth, which can be much faster than a normal search for large control trees. /// </summary> public static T RawGet <T>(this AutomationElement element, SearchCriteria criteria, int searchDepth) where T : UIItem { using (CoreAppXmlConfiguration.Instance.ApplyTemporarySetting(config => { config.RawElementBasedSearch = true; config.MaxElementSearchDepth = searchDepth; })) { var l = new NullActionListener(); var t = typeof(T); var factory = new PrimaryUIItemFactory(new AutomationElementFinder(element)); var e = factory.Create(criteria, l); return(e as T); } }
private Button FindButton(IActionListener listener, string automationId) { return ((Button) primaryUIItemFactory.Create(SearchCriteria.ByControlType(ControlType.Button).AndAutomationId(automationId), listener)); }
protected override IUIItem Find(SearchCriteria searchCriteria) { return(factory.Create(searchCriteria, actionListener)); }