Page 1 of 1

Modify Repository for inconsistant names.

Posted: Thu Nov 11, 2010 4:58 am
by Tobynz
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

Re: Modify Repository for inconsistant names.

Posted: Thu Nov 11, 2010 11:12 am
by Support Team
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

Re: Modify Repository for inconsistant names.

Posted: Sun Nov 14, 2010 10:12 pm
by Tobynz
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

Re: Modify Repository for inconsistant names.

Posted: Mon Nov 15, 2010 11:14 am
by Support Team
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