Depending on the technology of your application under test, your controls may have dynamic identifiers. You could of course adapt the path for each repository item, but you would have to do this every time a new item is added. The RxPathWeights plug-in enables you to filter out those identifiers and use an even better attribute to identify your application under test.

Ranorex 3.X comes with a RanoreXPath Weights Editor (available in the Ranorex Spy) which will help you to change/set-up rules.Have a look at our new blog post “Automated Testing and Dynamic IDs” for further information.

Set up your RxPathWeights configuration file (Ext-JS example)

Let’s assume we would like to automate a website which is built on the Ext JS framework (a cross-browser JavaScript library).

The picture below shows the RanoreXPath of an ext-js input field on following ext-js example page.


You can see containers in the path which are identified by the id, beginning with “ext-comp-” and ending with a numeric value. These ids are dynamically generated and they may change.

We would like to set up a filter mechanism which should eliminate id attributes beginning with “ext-gen” or “ext-comp-” and ending with a numeric value.

  1. Open the Ranorex Spy and analyze you application under test
  2. Navigate to the element which has the dynamic identifier
  3. Write down the attribute name and the capability to which the attribute belongs to
  4. Download and extract the “” to following location (only needed for the system on which you will record your test scripts):
    “C:Documents and SettingsAll UsersApplication DataRanorex2Plugins” (for Windows XP) or “C:ProgramDataRanorex2Plugins” (for Vista, 7)
  5. Open the “Ranorex.Plugin.RxPathWeights.config” file in a text editor program

The configuration file consists of a rule element and an underlying condition element. The rule element enables you to change the weight of an attribute. By setting the weight to zero, the element will not be used in the RanoreXPath as an identifier anymore.

The condition element enables you to specify a rule for the attribute. In our sample, we would like to filter out ids which match following regular expression syntax
“(ext-gen|ext-comp-)[0-9]*”. (Read more about regular expression syntax here…)

 <rule capability="webelement" attribute="id" setweight="0" conditionsoperator="or">
  <condition source="self" attribute="id"
        match="(ext-gen|ext-comp-)[0-9]*" negate="false"/>

Save the config file and restart the Ranorex tools to load the RxPathWeights plug-in.

RxPathWeights plug-in documentation

Role parameters:

  • capability/attribute: define the target capability/attribute of the rule
  • setweight: the weight to set if all the conditions evaluate to true
  • conditionsoperator: defines the operator (“and” / “or”) that is used to combine the outcomes of multiple conditions in a rule

Condition parameters:

  • source: can be self/parent/toplevel
  • attribute: the attribute name to match. Can be different from the rule attribute name
  • match: a regular expression. If you don’t specify the match value, the value of the attribute needs to be null to match
  • negate: the outcome of the condition is the negated outcome of the match, e.g. if negate=”true” and the match fails, the condition evaluates to true