If you’re working with a team, it can be very useful to share your weight rules, so that your colleagues can also avoid dynamic IDs and generate robust RanoreXPath expressions.
This page explains how it works and also contains the default weight rules in XML format.
Copy and paste weight rules
Ranorex Studio stores weight rules as XML files. Sharing weight rules works by copying and pasting the content of a weight rule in the configuration dialog for attribute weights.
-
In the configuration dialog for attribute weights, select the weight rule you want to share.
-
Right-click the weight rule and click Copy.
-
Paste the content into a text editor of your choice, save the file, and transfer it to the target machine.
-
On the target machine, copy the content of the file, and in the configuration dialog for attribute weights, paste it into the list of rules.
Default weight rules
RxWinForms ControlNet11 Classnames
XML
<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"></condition>
</rule>
RxWeb YUI (Yahoo User Interface Library)
XML
<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>
<condition
source="self"
attribute="id"
match="^yui-gen.*"
negate="False"></condition>
</rule>
RxWeb JS Frameworks (ExtJS, Sencha, Ozone Widget ,…)
XML
<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>
<condition
source="self"
attribute="id"
match="^[a-z]+-d{4}(-[a-z]*(-d*)?)?"
negate="False"></condition>
</rule>
RxWeb jQuery
XML
<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"></condition>
</rule>
RxWeb ASP.net
XML
<rule
name="RxWeb ASP.net"
enabled="False"
capability="webelement"
attribute="id"
setweight="0"
conditionsoperator="or">
<condition
source="self"
attribute="id"
match="^ctl00($|_)(.*($|_))"
negate="False"></condition>
</rule>
RxWeb GWT
XML
<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>
<condition
source="self"
attribute="id"
match="^isc_.+"
negate="False"></condition>
</rule>
RxWeb MS Dynamics CRM
XML
<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"></condition>
</rule>
RxWin32 Random Control IDs
XML
<rule
name="RxWin32 Random ControlIds"
enabled="False"
capability="nativewindow"
attribute="controlid"
setweight="0"
conditionsoperator="or"></rule>