Popup watcher taking a long time to instantiate

Ranorex Spy, Recorder, and Studio.
Andrew Simpson
Posts: 22
Joined: Thu Dec 03, 2015 11:58 am

Popup watcher taking a long time to instantiate

Post by Andrew Simpson » Thu Jan 19, 2017 6:04 pm

Hi,

I've written a popup watcher code module which appear to work fine, the only thing I've noticed is that it takes a long time to instantiate when the tests are being run manually(roughly 4 mins), this is pretty annoying as they are written into the setup of each suite.

Wondering if there's something regarding the code where it could be more eloquent to speed it up, Ive had a look at the user guides and the code is very similar and cannot see anyone with a similar issues

Here's the code,sorry for the lack of snapshot but the issue is random and occurs on the automation server overnight

Code: Select all

 {
            Mouse.DefaultMoveTime = 300;
            Keyboard.DefaultKeyPressTime = 100;
            Delay.SpeedFactor = 1.0;
            
            //Instantiate the popupwatcher
            PopupWatcher TcasErrorScreen = new PopupWatcher();
            
            //tell the popupwatcher what to look for 
            TcasErrorScreen.WatchAndClick(repo.TransactorOkNoYesPopups.SelfInfo,   repo.TransactorOkNoYesPopups.TcasRunTimeError402forpopupwatcherInfo);
            
            //start the popupwatcher
            TcasErrorScreen.Start();
            
            if(repo.TransactorOkNoYesPopups.TcasRunTimeError402forpopupwatcherInfo.Exists())
            {
            	Report.Failure("Run Time Error 402 Appeared");
            	Report.Screenshot(repo.TransactorOkNoYesPopups.Self);
            	repo.TransactorOkNoYesPopups.TransactorPopupOKBtn.MoveTo();
            	repo.TransactorOkNoYesPopups.TransactorPopupOKBtn.Click();
            	
            }

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

Re: Popup watcher taking a long time to instantiate

Post by krstcs » Thu Jan 19, 2017 7:20 pm

Remove the if block at the end. You don't need that, and it is what is causing the delay. It's waiting the full effective timeout of the repo.TransactorOkNoYesPopups.TcasRunTimeError402forpopupwatcher object for it to not exist so it can evaluate the if clause and continue.

The popup watcher itself is there to handle all of this for you, so you don't need to code this yourself.
Shortcuts usually aren't...

Andrew Simpson
Posts: 22
Joined: Thu Dec 03, 2015 11:58 am

Re: Popup watcher taking a long time to instantiate

Post by Andrew Simpson » Fri Jan 20, 2017 5:27 pm

Thanks very much :D