Page 1 of 1

Search Timeout

Posted: Fri Nov 09, 2012 3:06 am
by bsing
Hi there,

I have a user code module that waits until a dialog is visible before going to the next step. See below

Code: Select all

        public void WaitForPromptDialog()
        {
        	Ranorex.Form frmPrompt = "/form[@controlname='Prompt']";
        	
        	while (frmPrompt.Visible.Equals(false))
        	{
        		Delay.Milliseconds(500);
        	}
        }
However the Ranorex script fails due to Ranorex not finding the form (Search Timeouts at 10 seconds).

The actual form in the repository has a timeout of 30 seconds though. Why would it be timing out at 10 seconds? Is there a way I can set the 10 second timeout to say 1 minute?

Brad.

Re: Search Timeout

Posted: Fri Nov 09, 2012 7:43 am
by artur_gadomski
The timeout is different because you don't use repository item but create a new one from RxPath. Either use repository item or use this code:
public void WaitForPromptDialog()
{
    Ranorex.Form frmPrompt;
    bool found = Host.Local.TryFindSingle("/form[@controlname='Prompt']", new TimeSpan(0,1,0), out frmPrompt);
    if (!found) {
        Report.Screenshot();
        Report.Snapshot(Host.Local);
        Report.Failure("Could not find Prompt.");
        // leave either by throwing exception or returning
        throw new Exception();
    }
    while (frmPrompt.Visible.Equals(false))
    {
        Delay.Milliseconds(500);
    }
}
EDIT: if you're using repository it is recommended that you keep using repository. Otherwise you need to maintain RxPaths in 2 places.

Re: Search Timeout

Posted: Mon Nov 12, 2012 5:16 am
by bsing
Hi thanks for the example,

I have tried using the following code

Code: Select all

Validate.Exists("/form[@controlname='Prompt']", new Duration(60000));
which seems to do the same thing. Is there any differece in your code and the one above?

Re: Search Timeout

Posted: Mon Nov 12, 2012 7:32 am
by artur_gadomski
I think Validate posts a success message to report also, but I'm not sure. We don't use validate a lot here.