Agent is unable to identify TreeItem object

Ask general questions here.
User avatar
GordonRamsay
Posts: 11
Joined: Fri Feb 15, 2019 4:25 am

Agent is unable to identify TreeItem object

Post by GordonRamsay » Fri May 22, 2020 10:00 am

I am automating a program which is quite troublesome to me

Using the Spy tool I am able to track the TreeItem object, however, when I run this script on an Agent it does not detect it.

In my test, I run my AUT as another user, using Windows' "run as different user" feature. I thought maybe this was why I was unable to track the TreeItem object, however I was still able to Spy it when Spy was ran as a user with administrative priveleges.

My agent is being ran as an administrator, so I cannot understand why it is unable to detect the TreeItem object.

The path to the specific TreeItem is shown in the screenshots below which I have just cooked up:

Spy being ran as normal user
Image

Spy being ran as administrator
Image

I have attached two Snapshots of the /form, one which the agent captured using `Ranorex.Snapshot("/");` and the other using Spy as an administrator

Does anyone have any ideas?
Attachments
HPERecords_SpyAdmin.rxsnp
(109.36 KiB) Downloaded 3 times
HPERecords_AsAgentAsAdmin.rxsnp
(129.2 KiB) Downloaded 3 times
A clean Ranorex test suite will get you clean results.

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

Re: Agent is unable to identify TreeItem object

Post by odklizec » Mon May 25, 2020 11:12 am

Hi,

I can't help myself, but I see tree items in both snapshots?
TreeElements.png
TreeElements.png (233.33 KiB) Viewed 131 times
The only thing that bothers me, and which may be a reason of your problem, is the exclamation mark, shown in element 83421560? Unfortunately, I'm not sure what it exactly means? ;) I think you will have to contact Ranorex support and request a remote session with them, so they may analyze the issue directly on your machine. Also, are you sure that Ranorex settings are included in the solution and that the app is whitelisted?
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
GordonRamsay
Posts: 11
Joined: Fri Feb 15, 2019 4:25 am

Re: Agent is unable to identify TreeItem object

Post by GordonRamsay » Tue May 26, 2020 5:07 am

I forgot to upload the snapshot where I run Spy without admin priveleges, here it is
Attachments
HPERecords_SpyNoAdmin.rxsnp
(104.78 KiB) Downloaded 1 time
A clean Ranorex test suite will get you clean results.

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

Re: Agent is unable to identify TreeItem object

Post by odklizec » Tue May 26, 2020 7:38 am

Hi,

OK, so the control in question apparently requires the AUT to be run with admin rights. And from what I understood, the snapshot HPERecords_AsAgentAsAdmin was created via test started from agent started with admin rights? So what exactly is the problem? ;) The snapshot shows all items, so test should identify them as well. Could you please post exact (failing) xpath and entire report with recorded failure? 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

User avatar
GordonRamsay
Posts: 11
Joined: Fri Feb 15, 2019 4:25 am

Re: Agent is unable to identify TreeItem object

Post by GordonRamsay » Tue May 26, 2020 8:09 am

Ah I see, the problem was that the specific TreeItem object that my test was attempting to click was not present, as they are dynamically loaded as the user scrolls down the Tree
A clean Ranorex test suite will get you clean results.

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

Re: Agent is unable to identify TreeItem object

Post by odklizec » Tue May 26, 2020 8:17 am

Ah yes, this is the nightmare of lazy-loaded lists ;) Well, the only workaround for this is creating a loop which will scroll the tree (e.g. by page up/down keys) and try to search the item. There should be an example somewhere at this forum. Let me search it.

OK, here are they:
https://www.ranorex.com/forum/viewtopic ... 61&p=54578
https://www.ranorex.com/forum/viewtopic ... 47&p=49169
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