Change element type and name in RxPath

Class library usage, coding and language questions.
hellboy81
Posts: 25
Joined: Sun Dec 10, 2017 8:52 pm

Change element type and name in RxPath

Post by hellboy81 » Thu Mar 08, 2018 2:15 pm

What is the best way to change both name and type in last step of RxPath using Ranorex on-board classes?
combobox[@name='myCbElement.Input']
to
text[@name='myTbElement.Text']
without using my own Regex due on possible break if Ranorex XPath structure changes.

Reason:

I need to locate anoth element - textbox (if it exists) based on "base" combobox element.

Where can I find XPath parser/builder classes used by Ranorex?

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

Re: Change element type and name in RxPath

Post by odklizec » Thu Mar 08, 2018 2:45 pm

Hi,

Could you please be a bit more specific about your use case? What exactly you trying to achieve? Also, a Ranorex snapshot would be really helpful here! I guess you are talking about changing xpath from code instead of using repository element?

If the element type changes during your test, I think it would be better to use wildcard instead of specific type, so the path would look like this:
*[@name='myCbElement.Input']


As for changing element attribute, this should be done via variable:
*[@name=$elementName]

Where $elementName variable should be filled from data connector or parameter.
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