RxWeight plugin for attribute windowtext

Ranorex Studio, Spy, Recorder, and Driver.
Registration
Posts: 2
Joined: Fri Aug 20, 2010 10:44 am

RxWeight plugin for attribute windowtext

Post by Registration » Tue Aug 24, 2010 9:12 am

Hi,

I try to automate a native windows application. Currently ranorex spy and recorder prefer class, controlid and instance attributes to identify native windows. The application however provides meaningfull windowstext for many objects. I thought I could use the RxWeight plugin to change attribute preference but it doesn't work:

Ranorex.Plugin.RxPathWeights.config

Code: Select all

<rxpathweights>
  <rule capability="nativewindow" attribute="controlid" setweight="0" conditionsoperator="and">
    <condition source="self" attribute="windowtext" match="[A-Z_\.]+" negate="false"/>
  </rule>
  <rule capability="nativewindow" attribute="instance" setweight="1" conditionsoperator="and">
    <condition source="self" attribute="windowtext" match="[A-Z_\.]+" negate="false"/>
  </rule>
  <rule capability="nativewindow" attribute="class" setweight="2" conditionsoperator="and">
    <condition source="self" attribute="windowtext" match="[A-Z_\.]+" negate="false"/>
  </rule>
  <rule capability="nativewindow" attribute="windowtext" setweight="3" conditionsoperator="and">
    <condition source="self" attribute="windowtext" match="[A-Z_\.]+" negate="false"/>
  </rule>
</rxpathweights>
Without configuration rxpath looks like:

Code: Select all

...tabpagelist/element[@controlid='1004']/element/element[@controlid='59648']/element/tabpagelist/element[@controlid='106' and @class='...' and @instance='0']/element/element[@controlid='65280' and @class='...' and @instance='3']
With configuration I get somthing like:

Code: Select all

.../tabpagelist/element[3]/element/element[2]/element/tabpagelist/element[@controlid='106' and @class='PscSubControl' and @instance='0']/element/element[19]
Still windowtext is ignored. Please advice.
Kind Regards

Registration
Posts: 2
Joined: Fri Aug 20, 2010 10:44 am

Re: RxWeight plugin for attribute windowtext

Post by Registration » Tue Aug 24, 2010 11:14 am

Just found an explanation in the blog. The weight for windowtext must be higher than 200. Than it works!

Ranorex.Plugin.RxPathWeights.config

Code: Select all

<rxpathweights>
  <rule capability="nativewindow" attribute="windowtext" setweight="300" conditionsoperator="and">
    <condition source="self" attribute="windowtext" match="[A-Z_\.]+" negate="false"/>
  </rule>
</rxpathweights>

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: RxWeight plugin for attribute windowtext

Post by Support Team » Tue Aug 24, 2010 11:57 am

Right, in order to have Ranorex use an attribute in RanoreXPaths, its weight needs to be greater than or equal to 100. Attributes with a weight below 100 are considered transient and are not used in RanoreXPaths. The attributes in the default Ranorex plugins have weights between 0 and 200, depending on how unique the attribute usually is.

Consequently, you should use a weight smaller than 100 (e.g. zero) if you don’t want the attribute to be used in RanoreXPath at all and a weight greater than 200 for attributes that should definitely be used.

Regards,
Alex
Ranorex Team