Page 1 of 1

Slowness between click events

Posted: Thu Jul 20, 2017 6:29 pm
by kdreiling
I am stumped on an issue that I hope someone can help me with. I am recording WINForm click events navigating from one screen to the next. In that click event, threre could be 2 two dialogs windows that popup and I want to just click the OK button or the CLOSE button to continue navigation to the next screen. I do this with User Code and say if the repository item exists, click the button.

What is happening is 'IF' neither one of the dialog boxes displays, the recording hangs about 40-60 seconds before it starts the next recording and then sails along. I have multiple cases that I am running and it adds so much additional time to finish it is causing issues.

I have attached a document with screen shots. Please let me know if you have any questions or comments. I will appreciate greatly.

NOTE: I also tried a Popup-Watcher, but it added no value either. See commented code below.

///public void GroupNotePopupWatcher()
///{
///PopupWatcher MyGroupNoteCheck = new PopupWatcher();

/// Add a watch for the form, which will trigger the Method Group Note Exists
///MyGroupNoteCheck.Watch("/form[@controlname='frmGroupNotes']", CloseGroupNoteDialog);

///MyGroupNoteCheck.Start();
///}

///public static void CloseGroupNoteDialog (Ranorex.Core.Repository.RepoItemInfo myInfo, Ranorex.Core.Element myElement)
///{
///repo.FormGroupNotes.BtnClose.Click();
///}

///public static void CloseGroupNoteDialog (Ranorex.Core.RxPath myPath, Ranorex.Core.Element myElement)
///{
///repo.FormGroupNotes.BtnClose.Click();
///Ranorex.Report.Info("GroupNote Button Close has been clicked" );
///}

Re: Slowness between click events

Posted: Thu Jul 20, 2017 6:30 pm
by kdreiling
Please note there is an attachment with screen shots to assist.

Re: Slowness between click events

Posted: Thu Jul 20, 2017 7:06 pm
by krstcs
Unfortunately it looks like your attachment didn't make the transition.

Ranorex search patterns (i.e., how it searches) may be different than what you expect. Ranorex will keep searching for an item until it either (a) finds the item, or (b) the total timeout for that item and all parents has been reached (called the "effective timeout").

A human, on the other hand, will search only as long as it takes to visually check for non-existence (and we can do it much faster than a computer because we can reason). The computer must be told to check, and continue checking, until it finds the element or hits the timeout.

If you are trying to validate/check/use/click an item (in other words you are wanting it to exist), it will succeed (pass) when (a) happens (it finds the item), but fail when (b) happens (it hits the timeout without finding the item).

If you are trying to validate/check that an item DOES NOT EXIST, it is the opposite. If it finds the item (a), it will FAIL, if it searches for the full timeout (b) and DOES NOT find the item, it will pass.

So, what it sounds like is that your search is waiting the full timeout for the item to exist (because it doesn't exist) and then proceeding with the next step after that full timeout.

There are a few things you can do:

1. Don't worry about it, because you are probably not (and shouldn't be) watching the test run except when you are designing/debugging it. The point of automation is not speed, it's consistency (speed is usually a happy by-product).

2. Lower the timeouts in the repo. This is USUALLY NOT ADVISED!!! The only thing that changing the timeouts will do is lower the amount of time that Ranorex will search for the element before it decides that it can't be found. In MOST situations, this just makes the test FAIL FASTER, which is not what we usually want.

3. When using the Exists()/NotExists() methods, you can also pass in an OVERRIDE TIMEOUT. This is the recommended way to handle situations where you expect the element to not be there, but you need to make sure, and don't want to wait the full timeout. As long as your XPath is good, this will usually be all that you need to do in a situation where you are wanting an item to not exist.

The full public Ranorex API can be found here: https://www.ranorex.com/Documentation/Ranorex/

Hope this helps!