How can i set Ranorex to not use src in XPATH?

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
ducarpit
Posts: 23
Joined: Thu Apr 23, 2020 1:48 pm

How can i set Ranorex to not use src in XPATH?

Post by ducarpit » Thu Jul 16, 2020 7:58 am

Hi,
i have a problem when i recording some tests on a web application.
As you can see in the image,
ranorex_src.JPG
ranorex_src.JPG (19.94 KiB) Viewed 266 times
Ranorex memorize the XPATH of some elements with the src identifier instead of id (for example).
That's not good for me because at the next run, the src is not the same and the test crash.
I have to sobstitute the src identifier with id or others by hand, and that's very frustrating.
Is there a way to tell Ranorex not to use the src identifier for the XPATH for the elements?
Thanks a lot in advance...
Christian

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6275
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How can i set Ranorex to not use src in XPATH?

Post by odklizec » Thu Jul 16, 2020 10:32 am

Hi Christian,

Yes, it's possible to omit "src" from xpath generation procedure, by lowering its xpath "weight", or by increasing xpath weight of different attribute, you want to be used instead of "src". For more details about xpath weight, please check this user guide chapter...
https://www.ranorex.com/help/latest/ran ... namic-ids/
Basically, you must create a new weight rule, where you should specify "src" attribute with "0" value. By default, iframe src attribute has weight value set to 150. Just decrease this value and you are good to go ;)
2020-07-16_11-35-44.png
2020-07-16_11-35-44.png (48.62 KiB) Viewed 253 times
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

ducarpit
Posts: 23
Joined: Thu Apr 23, 2020 1:48 pm

Re: How can i set Ranorex to not use src in XPATH?

Post by ducarpit » Thu Jul 16, 2020 3:02 pm

odklizec wrote:
Thu Jul 16, 2020 10:32 am
Hi Christian,

Yes, it's possible to omit "src" from xpath generation procedure, by lowering its xpath "weight", or by increasing xpath weight of different attribute, you want to be used instead of "src". For more details about xpath weight, please check this user guide chapter...
https://www.ranorex.com/help/latest/ran ... namic-ids/
Basically, you must create a new weight rule, where you should specify "src" attribute with "0" value. By default, iframe src attribute has weight value set to 150. Just decrease this value and you are good to go ;)
2020-07-16_11-35-44.png
Hi,
thanks a lot, i made a simple test to try this solution and it seems work!
Is there a way to set up this xpath setting for all the projects?
Or have i to do this for each projects?
Thanks a lot in advance

Christian

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 6275
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How can i set Ranorex to not use src in XPATH?

Post by odklizec » Thu Jul 16, 2020 4:10 pm

Hi,

You can import settings from one project to another. Open the project you want to update with new src weight rule, open settings and there you should see Import button. Then select rxsettings from the project you already updated. That's all.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

ducarpit
Posts: 23
Joined: Thu Apr 23, 2020 1:48 pm

Re: How can i set Ranorex to not use src in XPATH?

Post by ducarpit » Mon Jul 20, 2020 10:14 am

odklizec wrote:
Thu Jul 16, 2020 4:10 pm
Hi,

You can import settings from one project to another. Open the project you want to update with new src weight rule, open settings and there you should see Import button. Then select rxsettings from the project you already updated. That's all.
Hi,
i tried but unfortunalty i didn't find the settings tab and the Import button.
Where they are?
Thanks a lot
Christian

User avatar
Stub
Posts: 378
Joined: Fri Jul 15, 2016 1:35 pm

Re: How can i set Ranorex to not use src in XPATH?

Post by Stub » Mon Jul 20, 2020 11:09 am

Down at the bottom-left of the Settings dialog.

ducarpit
Posts: 23
Joined: Thu Apr 23, 2020 1:48 pm

Re: How can i set Ranorex to not use src in XPATH?

Post by ducarpit » Tue Jul 21, 2020 8:03 am

Stub wrote:
Mon Jul 20, 2020 11:09 am
Down at the bottom-left of the Settings dialog.
Hi,
maybe i have to add some panels because i don't see the Setting dialog:
setting_dialog.JPG
setting_dialog.JPG (170.67 KiB) Viewed 209 times

User avatar
Stub
Posts: 378
Joined: Fri Jul 15, 2016 1:35 pm

Re: How can i set Ranorex to not use src in XPATH?

Post by Stub » Tue Jul 21, 2020 8:23 am

Press the "Open Settings" button on the toolbar to invoke the Settings dialog.