Object is quickly found by the spy, but not during runtime

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Object is quickly found by the spy, but not during runtime

Post by carsonw » Fri Nov 01, 2013 9:42 pm

So I have a bit of a complex RXPath with several variables. But this item is found immediately using the spy:

/dom[@caption~'.*('+'GlobalPay+ -'+')*.']//frame[@name='Middle']//div[#'FuturePaymentsResultsPanel']//table[@class='aggregate-table']//td[@innertext='TR4034358' and @data-bind~'orderConfirmationNumber']//following-sibling::td[@innertext='1']//..//..//..//table//tbody//tr[@class~'.*even-row|.*odd-row']//td[@innertext='TR4034358' and @data-bind~'orderConfirmationNumber']//following-sibling::td[@innertext='1']//..//tr//input

During runtime, however, I cannot find the object using this code:

Code: Select all

Host.Local.TryFindSingle(repositoryItem.AbsolutePath.ToResolvedString(), repositoryItem.SearchTimeout, out inputField);
I also just passed in repositoryItem.AbsolutePath but that didn't work either.

It's kind of a long story, but Host.Local.TryFindSingle is how I must find objects, this is something we use for all of our object recognition, but I seem to be having problems with this particular object.

There is no change from the page during runtime and using the object spy. I have the page sitting open and I can see the desired object on the page, however it's not found.

The search time out in , repositoryItem.SearchTimeout is 10 seconds.

The path itself is made up from three variables: 'GlobalPay+ - & TR4034358 & 1.

Any thoughts on how this can be? Like I said it finds it instantly in the spy, as soon as I run it, it's not found. All I did was output the value of repositoryItem.AbsolutePath.ToResolvedString() at run time and paste it into the spy, so I'm not sure what the difference could be.

Thanks in advance!

Carson.

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

Re: Object is quickly found by the spy, but not during runtime

Post by Support Team » Mon Nov 04, 2013 3:24 pm

Hi Carlson.

Do you use an embedded IE or an IE without Ranorex addon enabled? This may slow down the search.
Is it important for you that the search timeout is 10 seconds? If not, have you tried to set the timeout to e.g. 10 minutes and wait if the element can be found?

Regards,
Larissa
Ranorex Support

carsonw
Posts: 178
Joined: Tue Nov 08, 2011 10:01 pm

Re: Object is quickly found by the spy, but not during runtime

Post by carsonw » Tue Nov 19, 2013 1:22 am

I'm not quite sure what you mean by embedded IE - I just launch IE normally :)

The add-on is installed and enabled. It is important that the search is only 10 seconds because there are cases where I expect it NOT to be there, so I don't want to wait too long.

Apologies for the long delay in my response, I was away on vacation! :)

I will try again tomorrow and see if the result is the same. It's just totally bizarre because it's 100% ok in the spy and does not work reliably during execution (on the same machine, same web page within a minute of each other). Weird!

Carson.

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

Re: Object is quickly found by the spy, but not during runtime

Post by Support Team » Tue Nov 19, 2013 9:09 am

Hi Carlson,
vacation sounds nice ;)

Which spy do you use? The 64 bit spy or the 32 bit spy?
Have you tried running your testsuite without debugger?

I understand that you don't want to wait too long for elements getting found, but just out of curiosity, would the elements be found if you set the timeout to 30 sec for example?

To avoid the problem that you have to wait too long for elements NOT exist you can do the following:
- set the searchtimeout to e.g. 5 sec in code
- then validate for not exist
- and set the searchtimeout back to 30 sec.
Maybe this is a workaround for you.

Regards,
Larissa