Avoiding Delays

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
zshadow
Posts: 28
Joined: Sat Aug 30, 2014 5:17 pm

Avoiding Delays

Post by zshadow » Thu Sep 18, 2014 10:24 am

Hi,

What I am trying to do is wait for the footer to appear, and then check that the innertext contains a specific string, are there anyways of not adding delays as I have done and have something more robust, I appreciate your help. Also I am getting the error:
"Failed to instrument Java process", as shown below did you find a workaround for this problem ?

TdTag footerInfo = "/dom[1]//td[#'footerInfo']";
Delay.Milliseconds(200);
Validate.Exists(footerInfo);
Delay.Milliseconds(500);

if(footerInfo.InnerText.Contains("SRDS"))
{
Report.Info(footerInfo.InnerText);
}



===================
Ranorex 5.1
Windows 7 (VM)
Java 1.6.0_26

Intermittent Ranorex warnings on new Java windows/forms:
"Failed to instrument Java process. Please make sure you have enough privileges to access the process.
(This message is only shown once per report.)"

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

Re: Avoiding Delays

Post by odklizec » Thu Sep 18, 2014 8:10 pm

Hi,

I would suggest to use WaitForExists(timeout) instead of delays. It waits for existence of the associated repo item. Check this page for more details...
http://www.ranorex.com/Documentation/Ra ... Exists.htm
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

zshadow
Posts: 28
Joined: Sat Aug 30, 2014 5:17 pm

Re: Avoiding Delays

Post by zshadow » Fri Sep 19, 2014 11:19 am

Hi,

I tried the below but I get an error shown below :

repo.SymptomDrivenDiagnostics.FooterInfo.WaitForExists(10000);


Error :
'Ranorex.TdTag' does not contain a definition for 'WaitForExists' and no extension method 'WaitForExists' accepting a first argument of type 'Ranorex.TdTag' could be found (are you missing a using directive or an assembly reference?) (CS1061)

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Avoiding Delays

Post by Support Team » Tue Sep 23, 2014 2:37 pm

Hello zshadow,

It seems like you are using an old version of Ranorex. Please note that the "WaitForExists" method was introduced with Ranorex version 5.0.0.

Regards,
Robert

zshadow
Posts: 28
Joined: Sat Aug 30, 2014 5:17 pm

Re: Avoiding Delays

Post by zshadow » Wed Sep 24, 2014 9:51 pm

Hi Robert,
I am using Ranorex version 5.1.1

Regards

zshadow

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Avoiding Delays

Post by Support Team » Thu Sep 25, 2014 10:42 pm

To use the WaitForExists method you need a RepoItemInfo instance to call that method on. You have to use the Ranorex repository to create such an instance.

In your code, you search directly for an element with that line using the Adapter.DefaultSearchTimeout which is 10 seconds by default:
TdTag footerInfo = "/dom[1]//td[#'footerInfo']";
If the item is not found within that timeout, an exception will be thrown and the next code line will never be reached; i.e. footerInfo will not have a value then.

Either use the Ranorex repository where you can easily set a timeout within the element needs to appear or use a Host.Local.FindSingle call and specify the timeout there.

I recommend going through the first few chapters of the Ranorex User Guide :D

Regards,
Alex
Ranorex Team