How to force Ranorex "Adapter" to be used as Variable

Best practices, code snippets for common functionality, examples, and guidelines.
User avatar
_KK_
Posts: 36
Joined: Tue Nov 21, 2017 12:51 pm

How to force Ranorex "Adapter" to be used as Variable

Post by _KK_ » Fri Feb 16, 2018 9:09 am

Hello Forum!

Ranorex XPath consists of Adapters, Attributes and Values.

To make a module more "generic", it is preferred to use variables and use them later in DDT (data driven test).
But "Adapters" in Ranorexpath cant be forced to be a variable.
Examples for Adapters:
form
Container

button (useful to have it as variable)
progressbar (useful to have it as variable)
text (useful to have it as variable)

Example of XPath with variables for "Attributes" automationid and visible:

Code: Select all

.//form[@automationid='AID_Test']/progressbar[@automationid=$AutomationId and @visible=$visible]
The "Value" is in both cases a different variable.

When trying to change the Adapter progressbar into a variable, the Rx-Studio wont accept this.
Has someone an explanation for that?

Thanks in advance.

BR

Klaus

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

Re: How to force Ranorex "Adapter" to be used as Variable

Post by odklizec » Fri Feb 16, 2018 10:23 am

Hi,

The explanation is simple. Variables are currently supported only in values. Neither adapters nor attributes could be variabilized in current implementation of Ranorex xpath. The only thing you can probably do is to replace adapter with * character, which means “any” adapter. And of course, you can make a feature request via User Voice platform.
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

User avatar
_KK_
Posts: 36
Joined: Tue Nov 21, 2017 12:51 pm

Re: How to force Ranorex "Adapter" to be used as Variable

Post by _KK_ » Fri Feb 16, 2018 12:13 pm

Hi Pavel,

the asterisk made my day! :D

Thanks for this really awesome proposal which is excellent working.
In my case I can reduce the number of DDT files to 25% when having 4 different Adapters to be tested with so many controls as you like.


BR

Klaus