We are using DevExpress controls 18.2v. Unable to extract devexpress combo boxes edit using FlaUI to implement automation testing.
I tried multiple ways (Xpath, process id, etc., and no luck.) using the code below, unable to get a reference to the combo box; the below statement returned null.
using (var app = FlaUI.Core.Application.Launch(@"MYAPP.EXE"))
{
try
{
using (var automation = new UIA3Automation())
{
var mainWindow = app.GetMainWindow(automation);
ConditionFactory cf = new ConditionFactory(new UIA3PropertyLibrary());
var searchOptionSelection = mainWindow.FindFirstDescendant(cf.ByAutomationId("cmbSearch")); //?.Select(1);
var searchOptionSelection11 = mainWindow.FindFirstDescendant(cf.ByClassName("WindowsForms10.Window.b.app.0.134c08f_r6_ad1"));
var searchOptionSelection1 = mainWindow.FindFirstByXPath(@"/Window[3]/Pane[4]/Window[1]/Pane/Pane[1]/Pane/Pane/Tab/Pane/Pane/ComboBox"); //?.Select(1);
searchOptionSelection1 = mainWindow.FindFirstByXPath("//ComboBox[@AutomationId=cmbSearch]");
var cmbSearchButton = mainWindow.FindFirstDescendant(cf.ByName("Open")).AsButton(); //ComboBox edit button
var searchOptionSelection2 = mainWindow.FindAll(FlaUI.Core.Definitions.TreeScope.Descendants, cf.ByAutomationId("cmbSearch"));
}
finally
{
//dispose objects
}
}
Any help is much appreciated!
I figured out the solution. My app has multiple top windows, and they are not children of one another. So that caused FlaUI to return NULL.
Searching using a desktop, identified combo control and returned the reference...
AutomationElement desktop = automation.GetDesktop();
var comboxItem = desktop.FindFirstDescendant(cf.ByAutomationId("cmbSearch"))?.AsComboBox();
var comboxItemButton = desktop.FindFirstDescendant(cf.ByName("Open"))?.AsButton();
comboxItemButton.Click(true);
comboxItem.Select(1); // This is NOT working now.
Any idea on the last statement to make it work?