Page 1 of 1
Relative path from repository item
Posted: Thu Oct 17, 2013 3:12 pm
by Nicklas
Hi,
We have a piece of user code where we need to get the relative path from a repository item, is that possible? We know about GetPath(), but that only gives us the absolute path, right?
/Nicklas
Re: Relative path from repository item
Posted: Fri Oct 18, 2013 11:18 am
by Support Team
Hello Nicklas,
This is possible using "GetPath(PathBuildMode buildMode, Element relativeToElement)".
Please read the forum post
Relative Rxpath to windows controls to get more information.
Regards,
Bernhard
Re: Relative path from repository item
Posted: Tue Oct 22, 2013 9:09 am
by Nicklas
Thanks, however this is not what I meant, the question was not accurate. What I meant was: is there a way to get the xpath part of a repository item, i.e.
MyRepository
-MyDOM
--MyFolder :: //div[#'myDivID]
---MyItem :: ./input[@class='myClass']
We want to get the xpath of the MyItem without the basepath (which is the xpath of MyFolder).
Re: Relative path from repository item
Posted: Tue Oct 22, 2013 4:30 pm
by Support Team
Hi,
In order to get the RxPath of the item you need the RepoItemInfo object of the repository item. This object has an attribute named "
Path" which returns the RxPath of the item.
Ranorex.Core.Repository.RepoItemInfo itemInfo = repo.RootItem.RepoItemInfo;
Report.Info("Path: "+itemInfo.Path);
Regards,
Markus