Page 1 of 1

Object recognition working inconsistently

Posted: Fri Jun 01, 2018 4:57 pm
by RannyRex
Windows version: Version 1709 (OS Build 16299.374)
Ranorex Version 8.0.0+git.6b58189a
.Net Runtime version: 4.0.30319.4200

The problem:

I have created a generic entry in the object repository called, "General_Ok_Button" with RanoreXPath: //button[@text='OK']

Many tests use this object and it worked perfectly fine for a rather long time. At some point the recognition became inconsistent. I am not sure when this started. It may have been when I upgraded to 8.0.0, but I cannot prove that.

Here's the real kicker:

IF I go into the actual code module itself and run the test? It works perfectly fine - like a charm.
IF instead I click the "View Test Suite" icon on the toolbar (or click View -> Ranorex test suite) and then place a checkmark onto the single test that I want to run? It'll fail to recognize that OK button every single time - even after I increased the timeout.

I can open the object repository, right-click the item and select 'Highlight selected item' and it'll find the item within a few seconds without problem.

So, to sum it up... If I run the test through the actual code module itself it works fine. If I instead use the 'Test Suite' it will fail to recognize this object (and a few other objects) every single time.

Re: Object recognition working inconsistently

Posted: Sat Jun 02, 2018 11:29 am
by odklizec
Hi,

At first, please update Ranorex with most recent 8.1.1. Ranorex 8.0.0 is already somewhat old and there were many bug fixes introduced in later versions. So it’s definitely better to use actual version.

Re: Object recognition working inconsistently

Posted: Mon Jun 04, 2018 3:28 pm
by RannyRex
I've upgraded to 8.1.1+git.4526ebf7 and still experience the same behavior.

Re: Object recognition working inconsistently

Posted: Mon Jun 04, 2018 6:17 pm
by odklizec
Hi,

So one potential cause is ruled out :) Now could you please try to add a “Create Snapshot” action to the problematic recording? Just before the failing action. But instead of creating snapshot for given button, create a snapshot of its parent element, ideally snapshot of dialog the button in question belongs to. Then run the module both as standalone and from TestSuite.

My guess is, that the xpath is too generic but on the other hand, it should fail/work the same both if recording is started alone or from Test Suite. Anyway, the snapshot should tell us more.

Re: Object recognition working inconsistently

Posted: Tue Jun 05, 2018 8:17 am
by odklizec
Hi,

There is no need for snapshot anymore. I tried to reproduce the issue you described and you are right. If recording module is started from a test suite, Ranorex fails to find "OK" button with generic xpath you provided. If started as standalone module, Ranorex finds the button relatively quickly.

What's even more interesting, Ranorex report says the element is not found within 30s (which is the actual effective timeout), but it actually fails after 2m of search ;)
OKsearchtime.png
The truth is, that the xpath you are using is definitely too generic and may take some time to be found. What's puzzling, why it works in standalone Recording and not in Test Suite? Maybe a bug in Ranorex?

The workaround is to make the xpath a bit more specific, for example by adding an element with attribute 'processname'. This will improve the speed and reliability of Ranorex element search, both in Test Suite and standalone run.
/*[@processname='processnameofyourapp']//button[@text='OK'][@visible='true']

Re: Object recognition working inconsistently

Posted: Thu Jun 07, 2018 4:35 pm
by RannyRex
Ok, I'm glad you were able to see the same behavior as myself.

I'll play around with your suggestion about the processname, I agree that should be a quick and easy fix.

Thanks for your help!