Page 1 of 1

Change element type and name in RxPath

Posted: Thu Mar 08, 2018 2:15 pm
by hellboy81
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?

Re: Change element type and name in RxPath

Posted: Thu Mar 08, 2018 2:45 pm
by odklizec
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.