Page 1 of 1

How does FindSingle method works?

Posted: Tue Oct 31, 2017 6:31 am
by RekhaG
Hello,

i am trying to get a Container from the windows FORM using FindSingle method, but Ranorex is throwing an error message NoElement found for path

This is the Actual path for the container /form[@automationid='LoginWindow']/container[1]

Below is how i am trying to get it

public Form LoginForm
{
get
{
return DNA2UIMapsRepository.Instance.LoginWindow.Self;
}
}

public Container UserNameContainer
{
get
{
string rxPath = "/container[1]";
return LoginForm.FindSingle(rxPath,25);
}
}

Note: I have saved the LoginWindow Xpath in the repository and trying to do the find single using that path


Can someone help me here please?

Re: How does FindSingle method works?

Posted: Tue Oct 31, 2017 7:53 am
by odklizec
Hi,

Please post a Ranorex snapshot (not screenshot) of the problematic element. This would help us to analyze and better understand your problem and provide an adequate solution. Without (at very least) snapshot, we can only guess what's wrong. Thanks.

Re: How does FindSingle method works?

Posted: Tue Oct 31, 2017 8:30 am
by ahoisl
RekhaG wrote:string rxPath = "/container[1]";
You need to change this to a relative path by letting it start with "." -> "./container[1]".
However, that may not be the best path to use because of the index in there. It is usually better to search for some specific attribute value - if there are attributes to check :)

Additionally, a timeout of "25" milliseconds(!) is way to small. When you don't want to wait, just omit the timeout altogether, then Ranorex will just search once for the element.

Regards,
Alex
Ranorex Team

Re: How does FindSingle method works?

Posted: Tue Oct 31, 2017 7:42 pm
by RekhaG
Thanks ahoisl. It helped!