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

Bug reports.
User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3932
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

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

Post by odklizec » Wed Aug 28, 2013 2:06 pm

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?
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

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

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

Post by krstcs » Wed Aug 28, 2013 2:25 pm

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); 
Shortcuts usually aren't...

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

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

Post by Support Team » Wed Aug 28, 2013 3:13 pm

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
.
Image

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

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

Post by odklizec » Wed Aug 28, 2013 3:22 pm

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!
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