Specific RanoreXpath Weights

Ask general questions here.
Bat
Posts: 16
Joined: Thu Jul 03, 2014 2:16 pm

Specific RanoreXpath Weights

Post by Bat » Wed Sep 24, 2014 4:16 pm

I'm trying to setup the view spy to recognize my testing specific tag "data-rx" for our web page. I've setup the Weight Rule as fallows:
Name: DataRX
Capability: dynamic
Attribute: data-rx
Set Weight: 250
Match Conditions: Any
No Rules

When I spy on the object it doesn't pick up the path unless I disable "Enabled search by unique ID (if available)." The issue is when I disable that it also gives me a bunch of junk in my path.


The goal is just for it to grab my dynamic "data-rx" and its base panel. Any idea?

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Specific RanoreXpath Weights

Post by Support Team » Thu Sep 25, 2014 5:40 pm

Hi Bat,

I created a small sample where I used your rule and even though the "Enabled search by unique ID (if available)" is enabled Ranorex created the right RxPath: "..//iframe[@id='iframeResult']//form[#'form']/input[@data-rx='Unique']".
So could it be that you want that Ranorex uses the specific data-rx attribute instead of the unique id?

Regards,
Markus
.
Image

Bat
Posts: 16
Joined: Thu Jul 03, 2014 2:16 pm

Re: Specific RanoreXpath Weights

Post by Bat » Mon Sep 29, 2014 6:21 pm

Exactly. I would like ranorex to use "data-rx" over anything else if it is available. I've been told that the unique id may not be constant and is possible to change down the line.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Specific RanoreXpath Weights

Post by Support Team » Tue Sep 30, 2014 1:05 pm

Hi Bat,

If this should be the case, that the unique ids are not really unique, I would uncheck the "Enable search by unique ID" chechbox to disable the unique id search algorithm.
After you unchecked it Ranorex should create a proper RxPath with your specific "data-rx" attribute.

Regards,
Markus
.
Image

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Specific RanoreXpath Weights

Post by Support Team » Thu Oct 02, 2014 3:42 pm

Hi Bat,

In addition to my last post I also wanted to mention that you can create a rule to tell Ranorex to not use the id in case the "data-rx" attribute is available.
What needs to do:
You could add a rule to set the "data-rx" attribute to a high weight and in addition to that you could add another rule which will set the weight of the webelement id to 0 in case there is an attribute "data-rx" available as shown below:
Edit RanoreXPath Weight Rules.png
Edit RanoreXPath Weight Rules.png (37.29 KiB) Viewed 1139 times
Regards,
Markus
.
Image

Bat
Posts: 16
Joined: Thu Jul 03, 2014 2:16 pm

Re: Specific RanoreXpath Weights

Post by Bat » Fri Oct 03, 2014 2:11 pm

I went ahead and disabled the Search by Unique id and played around with the rules some more and I noticed something.

My Attribute value of "data-rx" was getting removed after opening the Weight Rules. Not sure how it was happening, so I just tried to recreate the problem and it seems to be holding now. If it happens again I'll report a bug to you guys.


Thanks for all the help Markus :mrgreen:

Bat
Posts: 16
Joined: Thu Jul 03, 2014 2:16 pm

Re: Specific RanoreXpath Weights

Post by Bat » Fri Oct 03, 2014 2:17 pm

Well, it happened again, though it looks like it just isn't displaying "data-rx" but is actually still there. You can see that Attribute is blank but when you share the rule it still has data-rx in it.

Also, I'm using:
Version 5.1.3.19973
Windows 7 x 64



Edit:
Is there a way to play with the General attributes? (Enabled, Index, Visible, etc)
Attachments
2014-10-03 09_14_59-Ranorex Spy (32bit) - Live.png
2014-10-03 09_14_59-Ranorex Spy (32bit) - Live.png (114.31 KiB) Viewed 1129 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Specific RanoreXpath Weights

Post by Support Team » Mon Oct 06, 2014 2:58 pm

Hi Bat,

You are not seeing the data-rx attribute since you selected an element which doesn't has an attribute named "data-rx".
When you select the dynamic capability just the attributes are shown which are really available from the currently selected element. When you selected another element in Spy which doesn't have an attribute named "data-rx" this attribute is also not shown in the Weight Rules, even though it is still selected.

What do you exactly mean with "Is there a way to play with the General attributes?"?
What exactly do you want to do?

Regards,
Markus
.
Image

Bat
Posts: 16
Joined: Thu Jul 03, 2014 2:16 pm

Re: Specific RanoreXpath Weights

Post by Bat » Wed Oct 08, 2014 1:45 pm

Ok, I wasn't sure why it wasn't showing up but now that you say the element must have that attribute it seems obvious. Thanks!


The general attribute that you see under Ranorex Spy when you look at the Path Editor. Specifically the Index.

For example
/div[2] has an index of 2.


Looking under the weights I don't really see anything that lets me set or edit the weight?
Attachments
2014-10-08 08_44_22-Ranorex Spy (32bit) - Live.png
2014-10-08 08_44_22-Ranorex Spy (32bit) - Live.png (92.34 KiB) Viewed 1092 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Specific RanoreXpath Weights

Post by Support Team » Thu Oct 09, 2014 2:58 pm

Hi Bat,

May I ask you to send me the Ranorex snapshot of the element shown in the screenshot?

Ranorex just uses the index in case there are no other attributes left which would allow Ranorex to distinguish between the same elements.
So I suppose there are no other attributes Ranorex can use instead.
The Ranorex snapshot will help me to check if there would be any other attribute which could be used instead.

Regards,
Markus
.
Image