I am currently writing autotests for a WPF application and faced a problem that getting the window that does not exist takes a lot of time (at least 1 minute on each autotest which is unacceptable).
I have a file saving dialog window that is sometimes opened. In order to not disturb other scenarios, I have to close such window at teardown.
The problem is that this if such window does not exist (for ex. it was closed) trying to get it takes at least a minute on each scenario. Is it possible to make it perform better?
public Window SavePrintOutputWindow
{
get
{
try
{
var printingScreen = MainScreen.ScreenWindow.ModalWindow("Printing");
var saveOutputWindow = printingScreen.ModalWindow("Save Print Output As");
return saveOutputWindow;
}
catch (Exception e)
{
return null;
}
}
}