Have you ever faced the issue where finding an UI element using TestStack White SearchCriteria API returns null? If yes, here are few alternatives that utilises the AutomationElement.
1 2 3 4 5 |
var tabGroup = window.Get<Tab>(SearchCriteria.ByControlType(ControlType.Tab));//return null //OR var tabUi = window.Get<UIItem>(SearchCriteria.ByAutomationId("ToolWindowTabGroupId"));//return null //OR var tabGroup = window.Get<Tab>(SearchCriteria.ByClassName("ToolWindowTabGroup"));//return null |
The alternative approach uses AutomationElement which is part of the Microsoft UI Automation API. Simply, it iterates through the children elements of AutomationElement of the White…