2011-04-28 26 views
4

我對此很陌生。我正在使用UI Automation來自動化我的應用程序。有沒有一種基於多個標識符來標識元素的方法。 當前僅基於一個標識符能夠識別的以下語法。自動化元素okbtn = dialogbox.FindFirst(TreeScope.Children,new PropertyCondition(AutomationElement.NameProperty,「OK」));UI自動化 - 基於多個標識符選擇對象

我想通過NameProperty和ControlTypeProperty來識別元素。

請讓我知道這是否可能。

感謝

回答

9
 Condition cMenuItem = new AndCondition(
      new PropertyCondition(AutomationElement.LocalizedControlTypeProperty,"text"), 
      new PropertyCondition(AutomationElement.NameProperty,"Appointment")); 

     AutomationElement aeMenuItem = aeTaskMenu.FindFirst(TreeScope.Descendants, cMenuItem);