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
Relative path from repository item
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Relative path from repository item
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
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
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).
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).
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Relative path from repository item
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.
Markus
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