We have inherited a big legacy WinForms application, that is using DevExpress controls (DevExpress.XtraNavBar.v8.1 and DevExpress.XtraEditors.v8.1) (I have been able to upgrade to version 15.1. It is a Project Converter tool oferred by DevExpress that allow you to use the latest DevEpress controls).
And there is a lot of pressure to stop doing manual testing and create an automation suite that will test the application. We have investigated the tools out there and White framework is the best tool for our need.
The problem is with DevExpress controls because we cannot identify them at all. Although we are able to identify the parent of those controls.
var application = Application.Launch(@"C:\App\app.exe");
var window = application.GetWindow(SearchCriteria.ByAutomationId("MainMDI"), InitializeOption.NoCache);
var menu = window.Get(SearchCriteria.ByAutomationId("navBarMainMenu")); // this is the parent of those DevExpress controls
// here throws an exeception because cannot find the 'Users' menu item (it is actually other text)
var users = menu.Get(SearchCriteria.ByText("Users"));
users.Click();
In the "inspect.exe" it shows that the parent has the children:
And this is using "UI Automation Verify":
UPDATE:
I have tried by taking the children of the parent, but it returns me a list with zero items:
var application = Application.Launch(@"C:\App\app.exe");
var window = application.GetWindow(SearchCriteria.ByAutomationId("MainMDI"), InitializeOption.NoCache);
var menu = window.Get(SearchCriteria.ByAutomationId("navBarMainMenu"));
System.Windows.Automation.AutomationElement automationElement = menu.AutomationElement;
AutomationElementCollection automationElementCollection = automationElement.CachedChildren; // the collection is empty
foreach (AutomationElement element in automationElementCollection)
{
string name = element.Current.Name;
if (name == "Users")
{
// try to click on it
}
}
UPDATE 2:
I have upgraded the DevExpress to v15.2, but I still cannot find any Automation Id.
P.S: Sorry for the green rectangles, the client does not want to show anything from the application.