Background
Ranorex 5.4.1
Windows 7
Google Chrome 45.0.2454...
I'm working on a Test suite to test the functionality of a website. The first TC opens the site in Google Chrome, then a number of TCs test the website functionality and the last TC closes Google Chrome. The test run is sometimes interrupted by a popup on various pages on the website.
I'd like to add a PopupWatcher to this test suite. How do I start? E.g. if I create a code module called "ClosePopUp" using Handling unexpected Dialogs, what do I do with that "ClosePopUp" module, do I put it into the set-up of the first TC?
Any suggestions or pointers would be appreciated.
Thanks!
Beginner questions on using PopupWatcher
Re: Beginner questions on using PopupWatcher
Hi,
Yes you are write, you should put this module in the beginning of your test suite. This will watch your pop ups and close them during your test execution. and finally you should stop the popup watcher in your last teardown .
or else you can include piece of code in your program.cs file
try{
PopupWatcher popupwatcher = new PopupWatcher();
// To check the exception dialog, if appears, calling the callback method to close the dialog.
popupwatcher.Watch(@"/form[@title='System failure' or @name='System failure']", ClosePopUpDialog);
popupwatcher.Start();
error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine);
}
// To close the exception dialog
public static void ClosePopUpDialog(Ranorex.Core.RxPath path, Ranorex.Core.Element element)
{
Report.Failure("Unexpected popup - exception occured, Please check the screenshot");
Report.Screenshot();
element.As<Ranorex.Form>().Close();
}
hope this will help you.
Yes you are write, you should put this module in the beginning of your test suite. This will watch your pop ups and close them during your test execution. and finally you should stop the popup watcher in your last teardown .
or else you can include piece of code in your program.cs file
try{
PopupWatcher popupwatcher = new PopupWatcher();
// To check the exception dialog, if appears, calling the callback method to close the dialog.
popupwatcher.Watch(@"/form[@title='System failure' or @name='System failure']", ClosePopUpDialog);
popupwatcher.Start();
error = TestSuiteRunner.Run(typeof(Program), Environment.CommandLine);
}
// To close the exception dialog
public static void ClosePopUpDialog(Ranorex.Core.RxPath path, Ranorex.Core.Element element)
{
Report.Failure("Unexpected popup - exception occured, Please check the screenshot");
Report.Screenshot();
element.As<Ranorex.Form>().Close();
}
hope this will help you.
Regards,
Subodh
Subodh
-
- Certified Professional
- Posts: 455
- Joined: Tue Feb 18, 2014 2:14 pm
- Location: Co Louth, Ireland
- Contact:
Re: Beginner questions on using PopupWatcher
Thanks very much for that Subodh. I will be working through that in the coming days and will reply back if I have any questions.