Application not able to identify objects

Ask general questions here.
alpesh.dhakad
Posts: 27
Joined: Wed Oct 31, 2018 2:10 pm

Application not able to identify objects

Post by alpesh.dhakad » Fri Jan 24, 2020 10:23 am

Hi Team,
Ranorex spy is not able identify objects though when we see in tree view item , objects are getting highlighted.
So, please suggest a way to identify the object.
Earlier we are able to identify objects directly.

For eg : Delete, Cut, Copy etc buttons are not highlighted by Spy when we search object. It is taking full list as highlighted.

Refer attached snapshot and screenshot.
Attachments
Delete - Not Highlighted.png
Screenshot
Delete - Not Highlighted.png (218.25 KiB) Viewed 286 times
Buttons Not highlighting.rxsnp
Snapshot
(1.64 MiB) Downloaded 9 times

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

Re: Application not able to identify objects

Post by odklizec » Fri Jan 24, 2020 10:54 am

Hi,

I already answered this problem here:
https://www.ranorex.com/forum/viewtopic ... 389#p58399
I see you are already updated Ranorex to most recent 9.2.1. What you can try now, is to change the WPF-related settings:
WPF_modes.png
WPF_modes.png (26.76 KiB) Viewed 281 times
Default and most recommended option is WpfImprovedOnly, but you can try also other modes. Just to see if there is any difference.
The last thing you can try is enabling GDI Capture. But that's probably all.

OK, yet another thing you can try, is to evaluate the control with MS Inspect tool. I guess you will get the same result as from Ranorex Spy, which means, that the problem is most probably in the control itself (its implementation).
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

alpesh.dhakad
Posts: 27
Joined: Wed Oct 31, 2018 2:10 pm

Re: Application not able to identify objects

Post by alpesh.dhakad » Tue Jan 28, 2020 7:03 am

Hi, Thanks for your inputs.
In our machine, we have WPF ImprovedOnly settings.

I tried your suggested steps and I am able to find the button directly via UIA plugin option.
But, when I am trying to execute the test then it is not able to find any objects using this settings.

Through UIA plugin option xpath is different from WPF Improved Only settings .

UIA :
/form[@automationid='me']/container[@automationid='BarManager']/container[@automationid='mainRibbon']//button[@name='Delete']

WPF Improved Only:
/form[@automationid='me']?/?/container[@automationid='PART_AutoHideControl']/list/list[1]/?/?/container[@automationid='PART_ItemsPresenter']/container[4]

Please suggest what should I do now to identify objects. (Our application is desktop application using Devexpress Controls)

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

Re: Application not able to identify objects

Post by odklizec » Tue Jan 28, 2020 8:05 am

Hi,

Well, I'm afraid, if UIA finds the elements and WPFImproved not, then your only option is to rework all xpaths in repo?
Eventually, you can switch between UIA and WPFImproved from code. So then you can keep the WPFImproved repo elements intact, set WPFImproved as default and switch to UIA only when you need to access elements with UIA xpath.

Check this post in which you can find an example of switching WPF from code:
https://www.ranorex.com/forum/live-trac ... tml#p43882
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

Hina1991
Posts: 1
Joined: Wed Jul 24, 2019 9:53 am

Re: Application not able to identify objects

Post by Hina1991 » Tue Feb 11, 2020 12:06 pm

Hi there,
I have a test that runs without errors on my screen (remote server). Now I have run the test with a colleague, now errors occur in some places. Even if I run the test on a different screen. Different errors occur e.g.

Failed to find item 'BMOTest2Repository.EXAPTpdoBMODatenbankEXABSPAnwe3.Form65281.Text8210'. Please check that your whitelist allows Ranorex to access the process.
No element found for path '/ form [@title>' EXAPTpdo / BMO, database '] /? /? / Form [@ controlid =' 65281 '] /? /? / Element [@ class =' ​​Gupta: Form 'and @ instance = '1'] / text [@ controlid = '8210'] 'at step' element [@ class = 'Gupta: Form' and @ instance = '1'] 'after 140 attempts within 1.5m.

The Button with Track Shows "Edit in Spy" /form[@title>'EXAPTpdo / BMO, Datenbank']/?/?/form[@controlid='65280']/?/?/element[@class='Gupta:Form' and @instance='1']/text[@controlid='8210']

Why does the ControlId change?

Can someone tell me why the test no longer runs on different screens / computers?

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

Re: Application not able to identify objects

Post by odklizec » Tue Feb 11, 2020 12:38 pm

Hi,

I think this problem is completely unrelated to the original post of this discussion? Next time, please create a new post because posting to someone else's post, with completely unrelated issue, causes a confusion. Thanks ;)

As for your problem, ControlIds, like those in your app, are not persistent and should not be used in repo xpaths. You must find and use another, more persistent, properties, like element labels, unique and not changing IDs, inner texts, or even use relationship operators (parent, child, ancestor, etc...). ControlId as in your app, are simply useless and must be replaced with something else. There is no way around. If you want help with finding more reliable xpaths, please post a Ranorex snapshot (NOT screenshot) of the problematic element(s) or entire app. Thanks.
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