Condition conditions = new AndCondition(new PropertyCondition(AutomationElement.IsEnabledProperty, true), new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.ListItem)); AutomationElement listitem = list.FindFirst(TreeScope.Children, conditions);//正常无误 list.FindAll(TreeScope.Children, conditions);//卡死 不造为何卡死。求解 |
|
#1 |
好像几十个可以很快出来
几百个上千个。 要等很久很久。甚至是 十几分钟。 |
200分
#2 |
没怎么用过这玩意
Header 也可以是列表控件的子级,ControlType.List、ControlType.DataItem或者ControlType.TreeItem等试试,胡乱猜的,没有深入研究过 |
#3 |
回复2楼: 搞定了 用这个 IUIAutomationElement list = elementBrowser.FindFirst(TreeScope.TreeScope_Subtree, conditionHyperlist); IUIAutomationCondition conditionHyperlistitem = _automation.CreatePropertyCondition(_propertyIdControlType, _controlTypeIdHyperListItem); IUIAutomationElementArray listitems = list.FindAll(TreeScope.TreeScope_Children, conditionHyperlistitem); using interop.UIAutomationCore; |