While evaluating Ranorex, I have a problem with implementing unexpected dialog/popup handling (as described here).
The problem I'm experiencing is that my implementation of ClosePopUpDialogs (which waits for two separate dialogs) does not work in case there are enabled multiple conditions. If I comment all conditions except one, the remaining one works OK. I'm sure it's something trivial in my dialog handling implementation

And another question, where are stored the screenshots taken by Report.Screenshot(repo.xyz.Self) code used in the ClosePopUpDialogs routine? Is there a way to display these screenshots (with warning) in the main test case report?
Thank you in advance!
Please see the code...
Code: Select all
class Program
{
public static QSpectorRepository repo = QSpectorRepository.Instance;
[STAThread]
public static int Main(string[] args)
{
Keyboard.AbortKey = System.Windows.Forms.Keys.Pause;
int error = 0;
try
{
// Creates and starts a new thread
// which handles unexpected dialogs
Thread dialogWatcher = new Thread(ClosePopUpDialogs);
dialogWatcher.IsBackground = true;
dialogWatcher.SetApartmentState(ApartmentState.STA);
dialogWatcher.Start();
error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine);
}
catch (Exception e)
{
Report.Error("Unexpected exception occurred: " + e.ToString());
error = -1;
}
return error;
}
public static void ClosePopUpDialogs()
{
while (true)
{
if (repo.Warning.SelfInfo.Exists() )
{
Thread.Sleep(300);
Report.Screenshot(repo.Warning.Self);
repo.Warning.Warning3.ButtonOK2.Click();
}
if (repo.FileNotSupported.SelfInfo.Exists())
{
Thread.Sleep(300);
Report.Screenshot(repo.FileNotSupported.Self);
repo.FileNotSupported.FileNotSupported3.ButtonOK2.Click();
}
Thread.Sleep(1000);
}
}
}