Page 1 of 1

FR: add option to use repo item in IList instead of RXPath

Posted: Wed Aug 28, 2013 2:06 pm
by odklizec
Hi,

Would it be possible to add an option to use the repo items in the IList definition, instead of RXPath?

For example, I'm using code like this in my project...
IList<Ranorex.TabPage> tabPageList = repo.LiteBox3d_FileTabs.TabPage.Find<Ranorex.TabPage>("/form[@title~'^LiteBox3D' and @processname='" + AUTProcessName + "']/*/*/*/tabpagelist/tabpage[@accessiblename!='dummy_text']");
The problem is that whenever the RX path changes (due to changes in GUI) I need not to forget to update the code as well (which I often do forget ;)). So the idea is to use the repository element path/name, instead of a full RX path. The code would then look like this...
IList<Ranorex.TabPage> tabPageList = repo.LiteBox3d_FileTabs.TabPage.Find<Ranorex.TabPage>(repo.LiteBox3d_FileTabs.TabPageInfo);
Does it make sense?

Re: FR: add option to use repo item in IList instead of RXPath

Posted: Wed Aug 28, 2013 2:25 pm
by krstcs
Can't you use the "RepoItemInfo.Path" variable like the following?

Code: Select all

IList<Ranorex.TabPage> tabPageList = repo.LiteBox3d_FileTabs.TabPage.Find<Ranorex.TabPage>(repo.LiteBox3d_FileTabs.TabPageInfo.Path); 

Re: FR: add option to use repo item in IList instead of RXPath

Posted: Wed Aug 28, 2013 3:13 pm
by Support Team
There is even a simpler alternative by using the CreateAdapters method of the info object:
var tabPageList = repo.LiteBox3d_FileTabs.TabPageInfo.CreateAdapters<Ranorex.TabPage>();
That way, you don't have to specify the repo item twice.

Regards,
Alex
Ranorex Team

Re: FR: add option to use repo item in IList instead of RXPath

Posted: Wed Aug 28, 2013 3:22 pm
by odklizec
Hi krstcs and Alex,

Thanks both of you for your suggestions!

@krstcs
Silly me. You are of course right! It was so visible solution I completely overlooked it ;) Thanks again.

@Alex
Interesting! I will definitely give it a try!