Page 1 of 1

multiple attribute weightings

Posted: Tue Sep 19, 2017 12:57 pm
by Tomsk666
Is there a way of creating rules to force Ranorex to use multiple attributes for an adapter role?
For example, in Ranorex, a Cell uses the Text attribute as it has the highest weighting by default.
I want it to use the ColumnIndex AND the RowIndex instead of the Text attribute.

So I create a rule that sets the Text attribute to zero.
I create another rule to set the ColumnIndex to 200
I create another rule to set the RowIndex to 200

So both the Column & Row index has the same weighting - I hoped that Ranorex would then use both attributes, but it doesn't. When I add a Cell object to the repository, it just uses the ColumnIndex.

Is there a way to force Ranorex to use two attributes (or more) when learning UI elements?

Re: multiple attribute weightings

Posted: Tue Sep 19, 2017 1:35 pm
by krstcs
Ranorex uses the first element of all of the highest weights and if that doesn't uniquely identify the element it will use the next attribute. It does not try to use multiple elements because that usually will cause maintenance issues where one of the attributes changes.

Tables are always going to be tricky. What I usually do is have the row be a rooted folder, then I have each column's cell be a separate element under the row's folder. This way you can pick the row and cell easily and if something changes you only have to change the cell element that changed, or the row by itself.

--MyAUT
----MyTable
------MyRow -> row[@rowindex=&MyRowIndex]
--------MyCellByIndex -> cell[@columnIndex=&MyColumnIndex]

Re: multiple attribute weightings

Posted: Tue Sep 19, 2017 2:25 pm
by Tomsk666
Thanks for the reply. Your approach is a good approach, and I'm happy to do this manually.
It would just be nice if you could get Ranorex to use multiple attributes by default for certain elements if you wanted.
My tables are static, but the text changes within the cells, so the text property is not appropriate, but the col & row indexes are static and are.
If I could get it to use multiple attributes, I wouldn't need any manual intervention in object recognition. Perhaps I'll stick it in the feature requests section...

Re: multiple attribute weightings

Posted: Tue Sep 19, 2017 2:33 pm
by krstcs
Honestly, managing the element repo and XPaths is usually the biggest part of Ranorex automation once you get the tests setup and running.

If you want to make a feature request, they only accept them through uservoice.ranorex.com.