Tracking element in desktop

Best practices, code snippets for common functionality, examples, and guidelines.
mmahra
Posts: 37
Joined: Wed Feb 26, 2020 2:17 pm

Tracking element in desktop

Post by mmahra » Fri Mar 13, 2020 6:26 am

Hello,

I just started using Ranorex Studio on desktop apps and one thing I noticed that if i rerun the recording 10 time without reopening the application, it works fine and successful, but once I close the application and include the Run Application step, the recording is not able to identify the application elements, and when I try to Track, I get a new a total new Xpath and the same goes on many many times.

Is this a known problem or is there any solution I can do about that?

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

Re: Tracking element in desktop

Post by odklizec » Fri Mar 13, 2020 8:32 am

Hi,

It's most probably caused by dynamic IDs captured in recorded xpath? Could you please share the xpath of problematic element? Basically, after each recording session, you must review all captured xpaths and eventually improve them, by removing all dynamic IDs, indexes and similar unstable attributes. Please check these posts about working with dynamic IDs:
https://www.ranorex.com/blog/automated- ... namic-ids/
https://www.ranorex.com/help/latest/ran ... namic-ids/
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

mmahra
Posts: 37
Joined: Wed Feb 26, 2020 2:17 pm

Re: Tracking element in desktop

Post by mmahra » Fri Mar 13, 2020 9:31 am

Hi Pavel,

I got the problem with dynamic identifiers and it is more common in Web recording but my problem was that Ranorex was identifying the window name differently each time in the repo, so all the elements below that repo had to be updated everytime and that was frustrating honestly.

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

Re: Tracking element in desktop

Post by odklizec » Fri Mar 13, 2020 9:38 am

Hi,

Well, as I mentioned, it's most probably caused by dynamic IDs(other attributes). Please post an example of xpath as you have it in repo and an example of new xpath. Basically, you must make the "root" path resistible for xpath changes. But it's impossible to tell what exactly you should do without seeing the xpath example. Ideally, post also a snapshot (NOT screenshot) of problematic element(s).
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

mmahra
Posts: 37
Joined: Wed Feb 26, 2020 2:17 pm

Re: Tracking element in desktop

Post by mmahra » Fri Mar 13, 2020 12:18 pm

Hello Pavel,

Thank you for your reply,

I hope I can explain the problem here well.

in this recording I am opening a bat file and validating on some text .

yesterday, Using the Ranorex tracking, I was only able to track the bat window, so I captured a Snapshot and got the "TextArea" Path and created an item in the repo and the ran the recording and it was working fine.

Today, I am using another VM and same problem mentioned in the topic appeared, the recording is failing, when I tried to make a new "Track" item for the bat window, it created another repo item (AdministratorSonicContainerDomain1 )and the one from yesterday (SonicContainerDomain1DomainManager) as if it doesn't exist, hence, I will not be able to take a snapshot of (SonicContainerDomain1DomainManager).
More over the new identified element (AdministratorSonicContainerDomain1 ) doesn't have a text area in the captured snapshot
I don't get the idea why is that happening?

I am not able to save a snapshot anymore, Still donno why :D
and the folder of snapshots doesn't appear anymore in the projects folder
Snapshots can be saved as log files only and I am not able to upload a log file

Thanks again
Last edited by mmahra on Thu Mar 19, 2020 11:12 am, edited 1 time in total.

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

Re: Tracking element in desktop

Post by odklizec » Fri Mar 13, 2020 1:09 pm

Hi,

Apparently, in one case, you are running the test/Studio as administrator, which means that all apps started from such test are started as administrator too. And because on another machine you are running test/solution as normal user, there is no "Administrator:" word in the title ;) This is why tracking creates new repo element. The title is simply different. And this is also probably why are not seeing the TextArea? It seems that if the app is started as Administrator, Ranorex is somehow not able to see the TextView? I've seen this discussed before on this forum. While Administrator mode usually helps with obtaining more elements from GUI, it's probably not this case? So try to run Studio and test as normal user.
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

mmahra
Posts: 37
Joined: Wed Feb 26, 2020 2:17 pm

Re: Tracking element in desktop

Post by mmahra » Mon Mar 16, 2020 4:57 am

Hello Pavel,

Thank you for your detailed reply and suggestions but I have tried the 4 probabilities here.
VM(Windows Server 2016): Admin and local user
Local machine(Windows10): admin and local user

On the VM i was not able to capture the text area by all means knowing that Ranorex was installed on the VM.
on the local machine, only title was different and text area was identified in both modes.
Last edited by mmahra on Thu Mar 19, 2020 11:13 am, edited 1 time in total.

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

Re: Tracking element in desktop

Post by odklizec » Mon Mar 16, 2020 8:16 am

Hi,

If the text area is not recognizable on VM, both in admin and normal mode, then there must be something different/missing on that very machine? I would suggest to start with checking if this particular machine has installed all Ranorex pre-requisities and eventually, reinstall them all...
https://www.ranorex.com/help/latest/ran ... uirements/
Ideally, run complete installation of Ranorex on that machine, even if you are not planning to use Studio on it.
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