Page 1 of 1

I'm doing tests with "dynamic id"

Posted: Tue Mar 20, 2018 7:55 pm
by jecardenasri01
I'm doing tests with "dynamic id"

I already create a corresponding rule but when I want to assign values ​​and do not take them.

when I run xpath and change the value of "id" to = 0, I do not care about "inner text" and apply changes but when validating again it is still the main "id" and not the "inner text"

I'm reviewing:
https://www.ranorex.com/blog/automated- ... namic-ids/

Re: I'm doing tests with "dynamic id"

Posted: Tue Mar 20, 2018 8:37 pm
by odklizec
Hi,

Please post a Ranorex snapshot of the problematic element a screenshot of the xpath weight editor with your actual settings. I’m afraid, there is not much anyone here can do or suggest without more details.

Re: I'm doing tests with "dynamic id"

Posted: Wed Mar 21, 2018 9:43 pm
by jecardenasri01
odklizec wrote:Hi,

Please post a Ranorex snapshot of the problematic element a screenshot of the xpath weight editor with your actual settings. I’m afraid, there is not much anyone here can do or suggest without more details.

I made a video in which I have 2 failures

1) I do not recognize the dynamic id when I select it from the repository, I should take the "most wanted list"

2) when I change the attribute id = 0 it does not change and it remains 200 and the inner text value remains the 2nd value and not the main one

https://www.youtube.com/watch?v=nAUHahm ... e=youtu.be

Re: I'm doing tests with "dynamic id"

Posted: Thu Mar 22, 2018 9:15 am
by odklizec
Hi,

I now see what's your problem. There are two problems. Firstly, you need to Apply the change in weight editor, before making another changes. Also, if you want to both decrease a weight value of an attribute and at the same time increase weight value of another attribute, you need to create TWO new rules. It can't be done in one rule! Selecting another attribute, in the same rule, simply resets the weight value (for selected attribute) back to its original state!

So in your case, you should decrease ID weight to 0 and press Apply. Then if you want to increase weight value of InnerText, you need to create another rule and in this new rule you can increase innertext's value. Yeah...the xpath weight editor is far from perfect and it would be nice to see some (heavy) improvements ;)

Now after setting the weight rule, you need to refresh the spy! Otherwise, you will still see the xpath with IDs.

Re: I'm doing tests with "dynamic id"

Posted: Tue Mar 27, 2018 1:20 pm
by jecardenasri01
odklizec wrote:Hi,

I now see what's your problem. There are two problems. Firstly, you need to Apply the change in weight editor, before making another changes. Also, if you want to both decrease a weight value of an attribute and at the same time increase weight value of another attribute, you need to create TWO new rules. It can't be done in one rule! Selecting another attribute, in the same rule, simply resets the weight value (for selected attribute) back to its original state!

So in your case, you should decrease ID weight to 0 and press Apply. Then if you want to increase weight value of InnerText, you need to create another rule and in this new rule you can increase innertext's value. Yeah...the xpath weight editor is far from perfect and it would be nice to see some (heavy) improvements ;)

Now after setting the weight rule, you need to refresh the spy! Otherwise, you will still see the xpath with IDs.

I do it like that but I do not know if I'm doing it wrong, because it's still not working

https://w ww.youtube.com/watch?v=Zr92EQtRnO4

Re: I'm doing tests with "dynamic id"

Posted: Tue Mar 27, 2018 1:29 pm
by odklizec
Hi,

The problem is that changing xpath weight is only a first step! After creating new xpath weight rules, you must recreate all existing xpaths in repo! You see, xpath weight is applied only to newly recorded elements, not the already existing elements (their xpaths). Eventually, you must open an existing repo element in Spy, and refresh its xpath. So then the xpath should change from using IDs to InnerTexts.

Re: I'm doing tests with "dynamic id"

Posted: Tue Mar 27, 2018 7:37 pm
by jecardenasri01
odklizec wrote:Hi,

The problem is that changing xpath weight is only a first step! After creating new xpath weight rules, you must recreate all existing xpaths in repo! You see, xpath weight is applied only to newly recorded elements, not the already existing elements (their xpaths). Eventually, you must open an existing repo element in Spy, and refresh its xpath. So then the xpath should change from using IDs to InnerTexts.


sorry I did not understand, could you give me an example

Re: I'm doing tests with "dynamic id"

Posted: Wed Mar 28, 2018 7:31 am
by odklizec
Hi,

There is not much to explain. You must re-create already recorded elements in repo (those with IDs in xpath).

Simply open each single xpath with ID in spy, make sure the app is in expected state (the element you want to update must be visible in GUI), switch to "Browser & Results" tab, right click the element, which xpath you would like to update and from the context menu select "Update path". That's all.
updatepath.png

Re: I'm doing tests with "dynamic id"

Posted: Mon Apr 02, 2018 1:30 pm
by jecardenasri01

Re: I'm doing tests with "dynamic id"

Posted: Tue Apr 03, 2018 8:12 am
by odklizec
Hi,

I'm afraid, I don't speak Spanish, but from what I've understand, your use of xpath weight editor is correct. The only thing I would do differently is that instead of deleting existing repo items (with dynamic IDs in their xpaths), I would simply open the items in Spy and update their xpaths, instead of re-recording them. Hope this helps?