Page 1 of 1
FindFromUID
Posted: Wed Mar 27, 2013 5:35 pm
by IanKnight
Hi,
I am trying to find a reference to a repository item by finding it via it's name (string value) and wondered if someone can help with the FindFromUID Method which is what I think I need.
I have tried this -
Element findelement = Ranorex.Core.Element.FindFromUID("ComboReferralType");
However this does not compile as Ranorex.Core.Element does not have this method but the documentation seems to say it does have it.
http://www.ranorex.com/Documentation/Ra ... romUid.htm
Any help / examples on how to use FindFromUID would be appreciated.
Ian
Re: FindFromUID
Posted: Thu Mar 28, 2013 5:52 pm
by Support Team
Hello,
Unfortunately it is not possible to get the object from a specific repository item using its name.
I am afraid that FindFromUID is not what you need because this method is searches for a unique identifier of a specific element in e.g. web element.
For example:
WebElement doc = "/dom[@domain='www.domain.com']/iframe";
Element result;
bool found = doc.Element.FindFromUid("yourID", out result);
Why do you search the repository item by its name?
Regards,
Bernhard
Re: FindFromUID
Posted: Tue Apr 02, 2013 8:44 am
by IanKnight
I want to search by name as I want to execute some user code and pass the repository object as a parameter.
As far as I understand it I can only pass a string value as a parameter, hence my attempt to find the repository object by name.
Re: FindFromUID
Posted: Wed Apr 03, 2013 3:35 pm
by Support Team
Hello,
Currently, it's only possible to pass string parameters to a User Code method.
We are evaluating to implement a way to pass repository items in a future release.
Regards,
Markus (T)
Re: FindFromUID
Posted: Wed Apr 03, 2013 4:16 pm
by IanKnight
Thankyou for the reply, I don't mind passing string values in parameters, what I want to do is find the object from that string parameter.
Is there a way of doing this ?
Re: FindFromUID
Posted: Thu Apr 04, 2013 4:30 pm
by Support Team
Hello,
Unfortunately, we don't provide a direct method to get the repository item by its name, but you could use reflection instead. More info about reflection can be found on
MSDN.
The following post should give you an idea how to use it with Ranorex:
Using reflection to get repository item
Regards,
Markus (T)