How to make dynamic path for button array

Ranorex Spy, Recorder, and Studio.
Priyanshu
Posts: 30
Joined: Wed May 22, 2019 5:48 am

How to make dynamic path for button array

Post by Priyanshu » Tue Nov 19, 2019 12:35 pm

Hi Team,

Below is the dynamic path which is getting change in every spy
/menubar[@processname='explorer']/container[@controlid='40965']//toolbar[@accessiblename='Running applications']/button[29]

Dynamic part is --- button[29]

could you please help how to make dynamic path?

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

Re: How to make dynamic path for button array

Post by odklizec » Tue Nov 19, 2019 12:44 pm

Hi,

Could you please post a Ranorex snapshot (NOT screenshot) of the problematic button? Without seeing, at very least, Ranorex snapshot, it's impossible to suggest something reliable. Generally speaking, it may be enough to simply remove button's index from the xpath. But if there are more buttons, it will most certainly return multiple buttons. Hence we need to see the snapshot, to determine the best approach. If there are no other identification attributes (like text, inner text or similar), you will most probably have to use another element as anchor, from which you must traverse to correct button (via relationship operators).
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

Priyanshu
Posts: 30
Joined: Wed May 22, 2019 5:48 am

Re: How to make dynamic path for button array

Post by Priyanshu » Tue Nov 19, 2019 12:54 pm

Hi ,

I have attached the snapshot.
Attachments
DynamicButton.zip
(32.9 KiB) Downloaded 11 times

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

Re: How to make dynamic path for button array

Post by odklizec » Tue Nov 19, 2019 1:00 pm

Hi,

It seems that the buttons contain accessible names and texts, so you can use something like this:
/menubar[@processname='explorer']/container[@controlid='40965']//toolbar[@accessiblename='Running applications']/button[@accessiblename~'Label Print Module'][@visible='true']
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