我想要使用下面的UI獲取組合框的listitems AUtomation代碼並返回零項。這個comobbox當然有物品,所以我做錯了什麼?Microsoft UI自動化不返回預期的組合框項目
var comboBox = GetMarketAreasComboBox();
var items = comboBox.FindAll(TreeScope.Element, new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.ListItem));
凡爲GetMarketAreasComboBox定義:
private AutomationElement GetMarketAreasComboBox()
{
var control = LocalRootAutomationElement.FindFirst(TreeScope.Descendants , new PropertyCondition(AutomationElement.AutomationIdProperty, "MarketAreasComboBox"));
Assert.IsNotNull(control);
return control;
}