Search Timeout

Ask general questions here.
HuongTT
Posts: 11
Joined: Thu Sep 15, 2016 3:55 am

Search Timeout

Post by HuongTT » Tue Nov 29, 2016 4:54 am

I use Ranorex 6.0.1 on Window 7-JP.

1.
I have a problem when handle exception.
In case click on a button, It may display message box or not. I use try/catch to find message box but timeout to find messagebox is too long (about 1min)
I try to change search timeout in setting but it did not work.
I try with duration.searchtimeout, time for search is 30seconds (it's still too long for automation test).
How to set timeout for search is <5s?

2. For UserCatch in property, sometime, there is no message box but it still return true for isMessageBoxDisplay. click select "property" on element to change usercatch to false but there is no dialog or window when I click on Property.
Anyone know this?

Thank you.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Search Timeout

Post by odklizec » Tue Nov 29, 2016 8:38 am

Hi,

At first, please update your Ranorex version with the most recent one 6.1.1. 6.0.1 is no longer supported.

As for your first problem, changing "Search Timeout" is usually useless, because Search Timeout value affects only the actual element. However, Ranorex search operation depends on Effective Timeout, which is a sum of SearchTimeouts of all ancestor repo elements for searched element! Please check this post.
http://www.ranorex.com/forum/how-to-mod ... tml#p28789

In order to shorten the search timeout, you can use RepoItemInfo.Exists() method, where you can define who long should Ranorex wait/search for the element appearance. And because it returns bool, you can process the result using simple conditional statement, instead of using Try...Catch. Here is an example:

Code: Select all

if (repoDetailTableInfo.Exists(5000)) //search if repo info element exists with 5sec timeout
{
    //do something if repo element is found
}
else
{
    //do something else if repo element is not found
}
As for your second problem, I'm not quite sure what's the problem, but with the above method, you don't have to bother with Try...Catch anyway ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

HuongTT
Posts: 11
Joined: Thu Sep 15, 2016 3:55 am

Re: Search Timeout

Post by HuongTT » Wed Nov 30, 2016 4:54 am

Thank you for your answer.

I can handle search timeout problem now.
repoDetailTableInfo.Exists(5000) work well.

My problem now: It's ok for message box which I know exactly when it may occur.
But, How to handle error message bog if I don't know when it will occur? It may occur during process or not...

I used trial Ranorex version 6.0.1, My company order Ranorex and it will available on December. I hope it is 6.1.1 :D

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Search Timeout

Post by odklizec » Wed Nov 30, 2016 8:18 am

Hi,

In case of randomly appearing messages/elements, you will have to use the solution as described here:
http://www.ranorex.com/support/user-gui ... html#c4678
The problem of this solution is, that it runs in a separate thread and there is currently no way to pause/stop the main test thread from popup handling thread.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration