Page 1 of 1

how to search for an element in a specific region

Posted: Wed Aug 22, 2012 11:26 am
by wyll
Hi,

what i want to know is, if there is a way to search for an element in the lower half of the screen or generell in a specific region, you selected before.

regards
wyll

Re: how to search for an element in a specific region

Posted: Wed Aug 22, 2012 11:36 am
by Support Team
Hi,

therefore please have a look at following chapter of our user guide:
RanoreXPath

In the "Functions" section you will see the x() and y() functions. Using this functions within a RanoreXPath you are able to identify elements based on there location.

So, as mentioned in the user guide, the RanoreXPath "/form[x()>100 and y()>100]" will identify all top level application with screen coordinates greater than 100.

Regards,
Tobias
Ranorex Team

Re: how to search for an element in a specific region

Posted: Wed Aug 22, 2012 1:26 pm
by wyll
Thanks a bunch,

is there also a way to write that in a usercode?
for example

int mycriteria = 100;

[y()>0 and x()>mycriteria]

regards wyll

Re: how to search for an element in a specific region

Posted: Wed Aug 22, 2012 1:31 pm
by Support Team
Hi,
wyll wrote:is there also a way to write that in a usercode?
Of course:
int mycriteria = 100;
Host.Local.FindSingle("RXPath/To/Your/element[y()>0 and x()>" + mycriteria.ToString() + " ]");
Regards,
Tobias
Ranorex Team

Re: how to search for an element in a specific region

Posted: Wed Aug 22, 2012 1:48 pm
by wyll
sweet,
thank you very much tobias