Page 1 of 1

Specific RanoreXpath Weights

Posted: Wed Sep 24, 2014 4:16 pm
by Bat
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?

Re: Specific RanoreXpath Weights

Posted: Thu Sep 25, 2014 5:40 pm
by Support Team
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

Re: Specific RanoreXpath Weights

Posted: Mon Sep 29, 2014 6:21 pm
by Bat
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.

Re: Specific RanoreXpath Weights

Posted: Tue Sep 30, 2014 1:05 pm
by Support Team
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

Re: Specific RanoreXpath Weights

Posted: Thu Oct 02, 2014 3:42 pm
by Support Team
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
Regards,
Markus

Re: Specific RanoreXpath Weights

Posted: Fri Oct 03, 2014 2:11 pm
by Bat
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:

Re: Specific RanoreXpath Weights

Posted: Fri Oct 03, 2014 2:17 pm
by Bat
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)

Re: Specific RanoreXpath Weights

Posted: Mon Oct 06, 2014 2:58 pm
by Support Team
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

Re: Specific RanoreXpath Weights

Posted: Wed Oct 08, 2014 1:45 pm
by Bat
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?

Re: Specific RanoreXpath Weights

Posted: Thu Oct 09, 2014 2:58 pm
by Support Team
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