Ranorex Help Center How can we help you?

RanoreXPath Weight Rule Library


Why RanoreXPath Weight Rules

If software is based on dynamic content it is typically based on dynamic identifiers. This might lead to problems in object recognition as these identifiers will be newly generated every time an element will be displayed.

One way to overcome this challenge is to manually adapt the repository after recording a test scenario which of course is very time-consuming.

The recommended way of handling dynamic content is to use RanoreXPath Weight Rules to optimize the object recognition for specific dynamic frameworks.

A path weight rule sets the weight of a specific attribute for a specific capability meeting a set of defined conditions. The weight will be used when building up the RanoreXPath. The attribute with the highest weight and a value other than empty will be taken for the identification of the UI element.

The RanoreXPath Weight Rules can be accessed via the 'RanoreXPath Weight Rules' editor ('Settings -> Advanced -> Edit Path Weights' or 'Ranorex Spy -> Edit Path Weights').

Edit RanoreXPath Weight Rules via settings dialog

Edit RanoreXPath Weight Rules via settings dialog



Edit RanoreXPath Weight Rules via Ranorex Spy

Edit RanoreXPath Weight Rules via Ranorex Spy



Using the RanoreXPath Weight Rules can assist you in automatically creating a robust repository which is the base of a robust test automation framework.

How to Add Your Own RanoreXPath Weight Rule

You can find a detailed description of how to add your own RanoreXPath Weight Rule in the blog post Automated Testing and Dynamic IDs.

If you want to share your RanoreXPath Weight Rules with the Ranorex community, please send your XML rule to [email protected] and provide us with a short description.

How to Add Shared RanoreXPath Weight Rules

Open 'RanoreXPath Weight Rules' editor from settings dialog (Settings -> Advanced -> Edit Path Weights).

Copy the specific XML rule from below (<CTRL> + <A>, <CTRL> + <C>) and paste it to 'RanoreXPath Weight Rules' Dialog by pressing <CTRL> + <V> or use the context menu.

Add shared rule

Add shared rule



Rule Library

RxWinForms ControlNet11 Classnames

<rule  
name="RxWinForms ControlNet11 Classnames"  
enabled="True"  
capability="nativewindow"  
attribute="class"  
setweight="0"  
conditionsoperator="and">  
    <condition  
    source="self"  
    attribute="class"  
    match="^WindowsForms10.Window"  
    negate="False"/>  
</rule>  



RxWeb YUI (Yahoo User Interface Library)

<rule  
name="RxWeb YUI (Yahoo User Interface Library)"  
enabled="True"  
capability="webelement"  
attribute="id"  
setweight="0"  
conditionsoperator="or">  
    <condition  
    source="self"  
    attribute="id"  
    match="^yui(_\d+)"  
    negate="False"/>  
    <condition  
    source="self"  
    attribute="id"  
    match="^yui-gen.*"  
    negate="False"/>  
</rule>  



RxWeb JS Frameworks (ExtJS, Sencha, Ozone Widget ,...)

<rule  
name="RxWeb JS Frameworks (ExtJS, Sencha, Ozone Widget ,...)"  
enabled="True"  
capability="webelement"  
attribute="id"  
setweight="0"  
conditionsoperator="or">  
    <condition  
    source="self"  
    attribute="id"  
    match="^ext-.*\d+.*"  
    negate="False"/>  
    <condition  
    source="self"  
    attribute="id"  
    match="^[a-z]+-\d{4}(-[a-z]*(-\d*)?)?"  
    negate="False"/>  
</rule>  



RxWeb jQuery

<rule  
name="RxWeb jQuery"  
enabled="True"  
capability="webelement"  
attribute="id"  
setweight="0"  
conditionsoperator="or">  
    <condition  
    source="self"  
    attribute="id"  
    match="^ui-id-\d+"  
    negate="False"/>  
</rule>  



RxWeb ASP.net

<rule  
name="RxWeb ASP.net"  
enabled="False"  
capability="webelement"  
attribute="id"  
setweight="0"  
conditionsoperator="or">  
    <condition  
    source="self"  
    attribute="id"  
    match="^ctl00(\$|_)(.*(\$|_))"  
    negate="False"/>  
</rule>  



RxWeb GWT

<rule  
name="RxWeb GWT"  
enabled="True"  
capability="webelement"  
attribute="id"  
setweight="0"  
conditionsoperator="or">  
    <condition  
    source="self"  
    attribute="id"  
    match="^gwt-uid-\d+.*"  
    negate="False"/>  
    <condition  
    source="self"  
    attribute="id"  
    match="^isc_.+"  
    negate="False"/>  
</rule>  



RxWeb MS Dynamics CRM

<rule  
name="RxWeb MS Dynamics CRM"  
enabled="True"  
capability="webelement"  
attribute="id"  
setweight="0"  
conditionsoperator="or">  
    <condition  
    source="self"  
    attribute="id"  
    match="[a-zA-Z_]+_{([0-9 A-F]+(-)?)+}_\d+"  
    negate="False"/>  
</rule>  



RxWin32 Random Control IDs

<rule  
name="RxWin32 Random ControlIds"  
enabled="False"  
capability="nativewindow"  
attribute="controlid"  
setweight="0"  
conditionsoperator="or"/>