I am trying to automate a WPF application. The target application has many tab controls.
The problem is that some times the tab controls fails to render a particular custom control.
This custom control is the parent `AutomationElement` of the child controls I would like to access. The tab renders the control sometimes and sometimes it doesn't. This behaviors is very random
Сценарий: дочерние вкладки загружены правильно
Изображение: дерево загружено правильно
теперь, когда я пытаюсь сделать следующее
//amusing I already searched for AutomationElement shippingScehduleTabAE
AutomationElement textAE = shippingScehduleTabAE.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "Text"));
textAE вернет правильный объект AutomationElement
Сценарий: дочерние вкладки загружаются неправильно
Изображение: дерево загружено неправильно
Здесь вы не найдете настраиваемый элемент управления внутри вкладки не загружен
//asuming I already searched for AutomationElement shippingScehduleTabAE
AutomationElement textAE = shippingScehduleTabAE.FindFirst(TreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "Text"));
textAE вернет null
, потому что эта конкретная иерархия дерева была удалена из дерева
Может ли у кого-нибудь быть возможное объяснение такого поведения автоматизации пользовательского интерфейса MS?