I am writing a Unit Test and using FlaUI. I launch an application and then get the main window which is getting the right window but when I try to get a dataGrid from the window it keeps returning null. The code I am using is below:
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo();
info.FileName = "TEST.exe";
info.Arguments = "Unit_Test";
info.UseShellExecute = false;
Application application = Application.Launch(info);
Window mainWindow = application.GetMainWindow(new UIA3Automation());
cf = new ConditionFactory(new UIA3PropertyLibrary());
var dataGrid = mainWindow.FindFirstDescendant(cf => cf.ByName("squadronGrid")).AsGrid();
Can anyone please help me with this?
I found and answer which works. I removed the following line:
cf = new ConditionFactory(new UIA3PropertyLibrary());
and changed cf.ByName to cf.ByAutomationId.
Thanks for your help.