Optimize Search Timeout for 1 action

Best practices, code snippets for common functionality, examples, and guidelines.
theraviz
Posts: 111
Joined: Sun Apr 14, 2019 9:46 am

Optimize Search Timeout for 1 action

Post by theraviz » Thu Aug 22, 2019 2:07 pm

Hi,

I want to set 1 seconds search time out for one particular action (only for this action).

I have provided 1 sin Search time out. But the Effective time out is still 31s which is not editable. So the execution still waits for 31s.
How can I change this 31 s to just 1 sec only for this particular action?
Capture.JPG
You do not have the required permissions to view the files attached to this post.

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

Re: Optimize Search Timeout for 1 action

Post by odklizec » Thu Aug 22, 2019 2:15 pm

Hi,

The only way how to change Effective timeout of an element is to change Search timeout of all parent elements. So in your case, you must change also Search timeout of parent element (probably root element) in which is placed the element you want to change.

Anyway, changing search timeout of repo elements is not a very good idea. Could you please explain in more details what exactly you trying to achieve? If you simply want to eliminate a search delay, in case an element does not exists, you should rather convert the action to user code and add if (element.Exists(timeout)) condition, in which you can perform (or ignore) given action.
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

theraviz
Posts: 111
Joined: Sun Apr 14, 2019 9:46 am

Re: Optimize Search Timeout for 1 action

Post by theraviz » Thu Aug 22, 2019 2:24 pm

Hi Yes,

I have 1 recording with 10 actions. While execution some times a pop up comes in between which is dynamic. If it is coming I can click and that is working fine. But if it is not coming I don't want the execution to wait for 30 seconds.

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

Re: Optimize Search Timeout for 1 action

Post by odklizec » Thu Aug 22, 2019 2:33 pm

Exactly what I've expected. Basically, you have two options. Either implement the solution I suggested in previous post. Or you can implement popoup watcher, from Ranorex Automation Helpers, which can watch for the appearance of of popup and click it in case it appears. If I were you and the popoup appears always at the same place of test, just randomly, I would implement the first solution.

Here is a pseudo code you may try to implement as a user code action:

Code: Select all

public void WaitAndClick(RepoItemInfo elementInfo)
{
    if (elementInfo.Exists(1000))
    {
        elementInfo.CreateAdapter<Ranorex.Unknown>(false).Click();
    }
}
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

theraviz
Posts: 111
Joined: Sun Apr 14, 2019 9:46 am

Re: Optimize Search Timeout for 1 action

Post by theraviz » Mon Aug 26, 2019 1:13 pm

The code worked. Thank you.

One more doubt, if I change the search time out of the parent control, will it reflect the same for all controls?