Check if Popup handler already running or not

Ask general questions here.
Shaifali
Posts: 7
Joined: Mon Feb 22, 2016 10:55 pm

Check if Popup handler already running or not

Post by Shaifali » Thu Jul 14, 2016 2:43 am

Hi,

We have functions to start and stop pop up handler. In most of the scripts we just want to close the popup. But in some scripts we want to handle the popup and do some other action on it instead of just closing it. So we made a practice to stop pop up handler at the end of the script if we have started it in the script, in order to make sure that it is stopped before running the next script.

But the problem we are facing with this scenario is, if some script fails before the step of stopping the popup handler. Then the scripts following it which were suppose to handle popup in other way fails, as the popup handler running and closes the popup before you can perform any other action on it. So to avoid that we need to have a condition which starts popup handler only if it is not running and stop the pop up handler if it is running.

Can you please let me know if there is any function to cater for the same?

Thanks

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Check if Popup handler already running or not

Post by krstcs » Thu Jul 14, 2016 2:01 pm

Move your popup handler starter to the setup section of your test case and move the stopper to the teardown section.

The teardown section is ALWAYS run, no matter the current test status (Success/Failed).


Also, if you haven't done so, please read the user guide (http://www.ranorex.com/support/user-guide-20.html) as it contains a great deal of information about this topic as well as many others.
Shortcuts usually aren't...

Shaifali
Posts: 7
Joined: Mon Feb 22, 2016 10:55 pm

Re: Check if Popup handler already running or not

Post by Shaifali » Fri Jul 15, 2016 5:52 am

Thanks for replying but we can't add stop popup handler in tear down because we have recordings in one test case such that one recording starts and stops popup handler whereas the recording following it assumes the popup handler is stopped.

And we don't want to keep them in separate test cases as it will increase the number of test cases tremendously.

That's why we need the condition to identify whether stop watch is started or not so that we can use it in our recordings or code modules.

jma
Posts: 111
Joined: Fri Jul 03, 2015 9:18 am

Re: Check if Popup handler already running or not

Post by jma » Tue Jul 19, 2016 3:45 pm

It sounds like those popups don't show up unexpectedly. If this is the case, I wouldn't recommend using the popup watcher at all because in my opinion the existence of the popup should be validated.

If you need the popup watcher to implement this use case, I would still suggest using the teardown section to stop the popup watcher like already suggested. If this is no option for you either, you could try executing the stop() function of the popup watcher in any case before the corresponding scripts are started.

Shaifali
Posts: 7
Joined: Mon Feb 22, 2016 10:55 pm

Re: Check if Popup handler already running or not

Post by Shaifali » Tue Jul 26, 2016 1:30 am

Is it possible to start pop up handler in one recording and stop it in another recording? Right now this is not working for me.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Check if Popup handler already running or not

Post by krstcs » Tue Jul 26, 2016 6:51 pm

Yes, that is exactly what I suggested in my post above.

You need to create the popup blocker as a separate class (not in program.cs or the recording) and then call it's start and/or stop functions in their own modules.
Shortcuts usually aren't...