Page 1 of 1

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

Posted: Wed Nov 11, 2020 5:21 pm
by stefan.hartisch
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']

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

Posted: Thu Nov 12, 2020 8:31 am
by odklizec
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.

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

Posted: Fri Nov 13, 2020 9:20 am
by stefan.hartisch
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.

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

Posted: Fri Nov 13, 2020 10:20 am
by odklizec
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.