Spy sets /?/? but elements in path completely recognized by name

Ranorex Studio, Spy, Recorder, and Driver.
stefan.hartisch
Posts: 6
Joined: Fri Jul 24, 2020 8:17 am

Spy sets /?/? but elements in path completely recognized by name

Post by stefan.hartisch » Wed Nov 11, 2020 5:21 pm

Hi together,
BROWSER & RESULTS in Spy recognizes my element with a continuous path of parent elements with names.
2020-11-11 17_17_43-Editing 'ArtForm.TabTerminal.RightSide.TerminalMes.Width'.png
The Update Path function turns it into a path with some /?/ elements, which works, but increases the runtime enormously.
If I manually put the path together with the found names it also works and faster at run time.

Why is Ranorex not able to build the path this way?

Thanks and best...
Stefan

Ranorex generated path:
/form[@controlname='MainForm']/tabpagelist[@controlname='tabControlData']/tabpage[@controlname='tabPageTerminal']/?/?/container[@controlname='splitContainer1']/container[@controlname='panel2']/?/?/tabpage[@controlname='page1Terminal']//container[@controlname='TerminalMes']/?/?/text[@controlname='upDownTerminalWidth']
Manually assembled path:
/form[@controlname='MainForm']/tabpagelist[@controlname='tabControlData']/tabpage[@controlname='tabPageTerminal']/container[@controlname='TerminalPanel']/container[@controlname='splitContainer1']/container[@controlname='panel2']/tabpagelist[@controlname='tabControl1']/tabpage[@controlname='page1Terminal']/container[@controlname='Page1Panel']/container[@controlname='splitContainer2']/container[@controlname='splitContainer2.Panel2']/container[@controlname='TerminalMes']/container[@controlname='tableLayoutPanel1']/text[@controlname='upDownTerminalWidth']
You do not have the required permissions to view the files attached to this post.

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

Re: Spy sets /?/? but elements in path completely recognized by name

Post by odklizec » Thu Nov 12, 2020 8:31 am

Hi,

Ranorex, of course, can create the xpath with all UI elements, like in your manually edited xpath. You just have to edit Ranorex xpath setting for xpath speed/robustness...
2020-11-12_8-19-17.png
Moving the slider to the left side, will create 'faster to find' xpaths, with all UI elements. However, there is a major catch! Such xpaths will be also much less flexible and easily breakable with even minor UI changes! For example, adding/removing one container to/from UI, will imediatelly break the xpath! So, it's actually OK to let Ranorex to create xpaths with relative attributes. I'm personally always editing every single recorded tracked xpath, adding or removing elements to my taste, removing all indexes and all potentially dangerous (dynamic) ID strings or even creating rooted folder structure in repo. It's not a good idea to absolutely rely on automatic repo elements creation and to leave repo xpaths as they are generated.
You do not have the required permissions to view the files attached to this post.
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

stefan.hartisch
Posts: 6
Joined: Fri Jul 24, 2020 8:17 am

Re: Spy sets /?/? but elements in path completely recognized by name

Post by stefan.hartisch » Fri Nov 13, 2020 9:20 am

Many thanks, that helped. But honestly, the word 'robustness' at this point is more than misleading in my opinion.
Anyway, now I can move on reasonably with the knob fully to the left (speed). Only with Instant Tracking there are still question marks. Can I turn it off there too?

Thanks a lot.

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

Re: Spy sets /?/? but elements in path completely recognized by name

Post by odklizec » Fri Nov 13, 2020 10:20 am

Hi,

Well, the xpaths with less elements and relative xpath attributes are really more robust and flexible, than the xpaths with 100% element coverage. I'm sure you will soon find out that ;)

As for the Instant Tracking, this setting should affect any kind of Spy tracking, including Instant Tracking? I just tested it and it generates the same xpath both with Tracking or Instant Tracking. Have you tried to restart standalone spy? Also, make sure there is the same setting both in Studio and standalone Spy.
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