示例#1
0
 /// <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);
     }
 }
示例#2
0
 private Button FindButton(IActionListener listener, string automationId)
 {
     return
         ((Button)
          primaryUIItemFactory.Create(SearchCriteria.ByControlType(ControlType.Button).AndAutomationId(automationId), listener));
 }
示例#3
0
 protected override IUIItem Find(SearchCriteria searchCriteria)
 {
     return(factory.Create(searchCriteria, actionListener));
 }