Hi Max,
You need to make 2 changes to your code to make it work reliably:
1) After opening any popup window you need to refresh the visual trees:
2) After clicking the button that closes the window you need to tell Test Studio that the window is closed. It is not able to automatically track this:
Regards,
Cody
Telerik
You need to make 2 changes to your code to make it work reliably:
1) After opening any popup window you need to refresh the visual trees:
public WpfWindow FindModeless() { var retries = 0; WpfWindow window = null; while (retries++ < MaxRetries) { Console.WriteLine("Attempt to FindModeless {0}", retries); try { if (window == null) { AppWrap.Application.MainWindow.RefreshVisualTrees(); window = AppWrap.Application.WaitForWindow("Modeless", TimePeriod.OneSecond * retries); // increasing wait time if (window == null) { continue; } } return window; } catch (Exception ex) { Console.WriteLine(ex.Message); } } return null; }2) After clicking the button that closes the window you need to tell Test Studio that the window is closed. It is not able to automatically track this:
public void HideModeless(){ // exception here... WpfWindow popup = FindModeless(); popup.Find.ByType<Button>().User.Click(); popup.Window.Close();}Regards,
Cody
Telerik