Hi, I don't know if the following is even possible but here goes:
I have the following repository structure
myContainer -> myButton1
-> myButton2
-> myButton3
I was hoping to pass in a string into a method, where the string is the name of the repo item in the repository, then use it as a repo path and call method.
So my method would be like this:
public void clickButton(string buttonName)
{
myCcontainer.buttonName.Click();
}
And I was hoping to call the method like this:
clickButton(myButton1);
Is there a way to do this?
How to convert string to repo item path
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: How to convert string to repo item path
Hi,
Reflection Overview:
http://msdn.microsoft.com/en-us/library ... s.71).aspx
Another possible solution would be so search the button by using the RxPath starting from the container level.
Regards,
Peter
Ranorex Team
To access the repository elements you have to use .Net Reflection. Currently Ranorex doesn't provide a direct way to access the repo elements as you want to access it.pksy wrote:Is there a way to do this?
Reflection Overview:
http://msdn.microsoft.com/en-us/library ... s.71).aspx
Another possible solution would be so search the button by using the RxPath starting from the container level.
Regards,
Peter
Ranorex Team
Re: How to convert string to repo item path
ok but, please, in which conditions can we use the following methods ?
ToResolvedString :
http://www.ranorex.com/Documentation/Ra ... String.htm
Implicit :
http://www.ranorex.com/Documentation/Ra ... plicit.htm
Is there a way to use this metods to store the current repository Item path to a variable ?
Thank you in advance
Florent
ToResolvedString :
http://www.ranorex.com/Documentation/Ra ... String.htm
Implicit :
http://www.ranorex.com/Documentation/Ra ... plicit.htm
Is there a way to use this metods to store the current repository Item path to a variable ?
Thank you in advance
Florent
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: How to convert string to repo item path
Hello Florent,
I am afraid that these two methods are not able to do what you want. It would be better to use the 'AbsolutePath' property instead.
Bernhard
Ranorex Support Team
I am afraid that these two methods are not able to do what you want. It would be better to use the 'AbsolutePath' property instead.
String btn = repo.Application.ButtonInfo.AbsolutePath.ToString();Regards,
Bernhard
Ranorex Support Team
Re: How to convert string to repo item path
U can try the below one also.
String str_btn = repo.Application.ButtonInfo.GetPath.ToString();
String str_btn = repo.Application.ButtonInfo.GetPath.ToString();