RanoreXPath in Code Modules?

Ranorex Spy, Recorder, and Studio.
steffi
Posts: 4
Joined: Mon Dec 09, 2019 2:45 pm

RanoreXPath in Code Modules?

Post by steffi » Tue Dec 17, 2019 10:41 am

Hey,

I am using Ranorex Studio for testing our GUI Software.

Because it often takes a little longer to find an element, I wondered if it would be faster to use the RanoreXPath instead of the tree path in the browser editor.

Can I use the RanoreXPath in a code module or is the element only recognized via the tree path in the element browser?

Thanks,
Steffi

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

Re: RanoreXPath in Code Modules?

Post by odklizec » Tue Dec 17, 2019 2:03 pm

Hi,

Of course, you can use Ranorex xpaths in code. But no, I don't think it will be faster to find elements via code than using repository elements. In fact, and unless you know really well what you are doing, it may take longer and may bring some more problems than advantages.

BTW, if an element takes longer to find than you like, then the repo xpath most probably needs some improvements? Could you please post a Ranorex snapshot (NOT screenshot) of the element, which typically takes longer to find? And of course, post also an xpath (whole xpath) used in repository.
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

steffi
Posts: 4
Joined: Mon Dec 09, 2019 2:45 pm

Re: RanoreXPath in Code Modules?

Post by steffi » Wed Dec 18, 2019 1:45 pm

Hi,

I honestly don't know, if you mean what I'm sending you now.

I'm just figuring out how Ranorex Studio works.

Especially with Drop-Down-Buttons, it takes a long time in the test to find the element.
But also with normal buttons.

I send you know the snapshot of an Drop-Down-Button, with which you can select a Station.

This ist the RxPath (copy from Ranorex Spy):
/form[@title='Auftrags-Übersicht']/indicator[@automationid='BusyIndicator']/list[@automationid='RadDocking']//statusbar[@automationid='StatusBarFilter']/?/?/toolbar/text[1]/list[@automationid='FilterComboBox']/button[@automationid='PART_DropDownButton']

I hope this is the right thing. :)
Attachments
PART_DropDownButton.rxsnp
Snapshot Drop-Down-Button
(970.84 KiB) Downloaded 10 times

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

Re: RanoreXPath in Code Modules?

Post by odklizec » Wed Dec 18, 2019 2:17 pm

Hi,

At first, you are using an outdated version 9.1.2. Please update Ranorex with most recent 9.2.1.

At next, the xpath you posted, returns 2 combo box elements! Which means, the xpath is not specific enough and must be improved!
ComboBoxes.png
ComboBoxes.png (66.63 KiB) Viewed 162 times
For example, you can use this, to detect the combo with label Max:
/form[@title='Auftrags-Übersicht']/indicator[@automationid='BusyIndicator']/list[@automationid='RadDocking']//statusbar[@automationid='StatusBarFilter']/?/?/toolbar/text[@text='Max:']/list[@automationid='FilterComboBox']/button[@automationid='PART_DropDownButton']
Unfortunately, the other two combo boxes in given toolbar does not have label, so you will most probably have to use index number to make them uniquely identifiable. Sadly, indexes are not pretty reliable solution in long term run. But I see no other way to identify unlabeled combo boxes.

Additionally, what you can do is to add the AUT process name to Ranorex white list, to make the element search significantly faster.
https://www.ranorex.com/help/latest/ran ... telisting/
Last edited by odklizec on Thu Dec 19, 2019 10:44 am, edited 1 time in total.
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

steffi
Posts: 4
Joined: Mon Dec 09, 2019 2:45 pm

Re: RanoreXPath in Code Modules?

Post by steffi » Thu Dec 19, 2019 10:42 am

Hi,

Thank you very much!

This was a great help for me.

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

Re: RanoreXPath in Code Modules?

Post by odklizec » Thu Dec 19, 2019 10:44 am

Hi,

You are welcome ;)
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