Modify Repository for inconsistant names.

Ranorex Spy, Recorder, and Studio.
User avatar
Tobynz
Posts: 3
Joined: Wed Oct 06, 2010 11:44 pm
Location: Christchurch, New Zealand

Modify Repository for inconsistant names.

Post by Tobynz » Thu Nov 11, 2010 4:58 am

Hi
Our application changes the name of several objects each time it is built. I have changed the repository for the recorded project to use xpath to find the objects after each build but the repository seems to get overwritten every time I open Ranorex. How do I impliment xpath to find an object if Ranorex keeps overwriting my changes - not much point in having the power of xpath if you cant impliment it?

i.e.
The recorded path in the repository is:
_atagfind_userInfo = new RepoItemInfo(this, "ATagFind_User", "body/div/form/div[@id='headerbar']/div[@id='mainmenu']/table/tbody/tr/td[3]/div[@id='ctl00_TopMenun8Items']/table/tbody/tr[@id='ctl00_TopMenun39']/td/table/tbody/tr/td/a[@innertext='Find User']", 10000, null);

However, when we rebuild our product the /tr[@id='ctl00_TopMenun39'] menu is sometimes shuffled internally on the build to have a topmenu item number anywhere between 0 and 100 e.g. /tr[@id='ctl00_TopMenun42']

I can get around this by using regular expressions like /tr[@id~'ctl00_TopMenun[0-9]'] but this gets overwritten by Ranorex every time. Anyone know how to get around this?

Thanks
Toby Martin
Test Lead

"If you chase two rabbits, both will get away"

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

Re: Modify Repository for inconsistant names.

Post by Support Team » Thu Nov 11, 2010 11:12 am

Hi,

When I understand you correctly, your id will be generated dynamically, right?
Have you tried to remove the attribute of this element and use only the adapter (only the tr).
If the RxPath to the element under this tag is uniquely identifiable, you can remove this attribute.

Regards,
Peter
Ranorex Team
.
Image

User avatar
Tobynz
Posts: 3
Joined: Wed Oct 06, 2010 11:44 pm
Location: Christchurch, New Zealand

Re: Modify Repository for inconsistant names.

Post by Tobynz » Sun Nov 14, 2010 10:12 pm

Thanks for the quick reply Peter.
Unfortunatly I am only in the process of evaluating Ranorex and do not quite understand what you are suggesting. What I have tried is changing the path in the repository.cs file but this keeps being overwritten. I need to have the repository use the modified path that has the regular expression in it to find the objects at runtime. Is this possable?

Thanks
Toby Martin
Test Lead

"If you chase two rabbits, both will get away"

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

Re: Modify Repository for inconsistant names.

Post by Support Team » Mon Nov 15, 2010 11:14 am

Hi,

If you change the RxPath directly in the repository.cs file, then your changes will be overwritten if you compile your project, please take a look to the header, there you will find a comment like "Don't change this code, your changes will be lost, because this file is auto-generated". To change the RxPath for an specific item during runtime, please take a look to following post
http://www.ranorex.com/forum/repository ... html#p5820

Regards,
Peter
Ranorex Team
.
Image