Attribute weights are integer values assigned to UI element attributes. They control which attributes Ranorex Studio uses in RanoreXPath expressions to identify UI elements.
What are attribute weights?
To reliably identify UI elements, Ranorex Studio can choose from more than 600 attributes that are derived from two categories: role-specific characteristics and technology-specific capabilities.
Aside from an attribute name (for example, ControlName) and an element-specific attribute value (for example, RxButtonExit), each attribute also has a weight value. This weight value is an integer between 0 and 200.
When generating a RanoreXPath for a UI element, Ranorex Studio uses the attribute with the highest weight to identify the UI element. Attributes with weights below 100 (for example, starting from 99) are ignored for RanoreXPath generation. (They may instead be used for automatic name generation for repository items).
Therefore, from the attributes in the image above, Ranorex Studio would use ControlName to identify the Exit button in the Ranorex Studio Demo Application because it has the highest attribute weight at 150.
Ranorex Studio contains default attribute weights for all attributes. These are based on testing and experience and work well in most cases. However, in some cases, you may need to fine-tune them. Reliably identifying UI elements with dynamic attributes is one such case. Below, find more information on where you can find the dialog to edit attribute weights.
Configuration dialog for attribute weights
To open the dialog for configuring attribute weights, do one of the following:
-
In Ranorex Studio or Ranorex Spy, click Settings > Advanced > Edit attribute weights….
-
In Ranorex Spy under Browser & Results, select an element in the element tree, and under Overview, click Edit path weights…
The configuration dialog opens:
-
Overview of all currently existing attribute weight rules and buttons to add, delete, and disable them.
-
Button to restore the default attribute weight values
-
Fields to name the rule and to control which attribute’s weight you want to change and whether conditions should apply
-
Link to display the attribute weight values for this rule (see image below)
-
Fields to create and edit rule conditions