Object recognition working inconsistently

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
RannyRex
Posts: 3
Joined: Fri Jun 01, 2018 4:05 pm

Object recognition working inconsistently

Post by RannyRex » Fri Jun 01, 2018 4:57 pm

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.

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

Re: Object recognition working inconsistently

Post by odklizec » Sat Jun 02, 2018 11:29 am

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.
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

RannyRex
Posts: 3
Joined: Fri Jun 01, 2018 4:05 pm

Re: Object recognition working inconsistently

Post by RannyRex » Mon Jun 04, 2018 3:28 pm

I've upgraded to 8.1.1+git.4526ebf7 and still experience the same behavior.

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

Re: Object recognition working inconsistently

Post by odklizec » Mon Jun 04, 2018 6:17 pm

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.
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

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

Re: Object recognition working inconsistently

Post by odklizec » Tue Jun 05, 2018 8:17 am

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
OKsearchtime.png (47.02 KiB) Viewed 236 times
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']
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

RannyRex
Posts: 3
Joined: Fri Jun 01, 2018 4:05 pm

Re: Object recognition working inconsistently

Post by RannyRex » Thu Jun 07, 2018 4:35 pm

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!