Hello,
It is a bit tricky to implement your desired behavior.
Please follow these steps:
1) You need a bool field and a PopupWatcher in your UserCode:
private static bool abortTest = false;
private static PopupWatcher myPopupWatcher = new PopupWatcher();
private void Init()
{
string yourItem = "/form[@title~'^Risk\ Policy\ Manager\ -\ Win']/element[@class='Frame Tab']//listitem[@text='Done']";
myPopupWatcher.Watch(yourItem, WarningIsShown);
myPopupWatcher.Start();
}
2) You need to create a method for the PopupWatcher:
public static void WarningIsShown(Ranorex.Core.RxPath myPath, Ranorex.Core.Element myElement)
{
Report.Info("Warning is shown!");
abortTest = true;
myPopupWatcher.Stop();
}
3) You need to add a UserCode method in your recording (last action e.g.):
public void endTest()
{
if (abortTest)
{
throw new Exception("Test was aborted because of a popup.");
}
}
Please try out these steps.
Regards,
Markus (T)