Page 1 of 1

Getting Ranorex Xpath of Controls

Posted: Thu Apr 01, 2010 7:43 am
by KeySam
Ok i am currently wirting a programm that should automate some of our intern software, therefore i want to kind of emulate ranorex spy. I want the user to just mark a control and being able to add it to a "library" via click(adding the Ranorex Xpath), later it can be used to automate tests. For now i have a workaround for this which seems to work okay, i let the user use Ranorex Spy to get the main control windows xpath copy paste it in my apllication and Go through all controls of the application he selected, afterwards once he marked a control i can then add the xpath to my application.

Now my question is is there an easier way to just get the xpath via click on a control or shortcut + click into my code. Or can you tell me how i can get the xpath of the main application when i have its process?

Your help would be very appreciated.

Nikolas Crisci

Re: Getting Ranorex Xpath of Controls

Posted: Thu Apr 01, 2010 3:48 pm
by Support Team
Hi,

I think what you are looking for is the FindFromPoint() method. This method returns you the path of the pointed element.
e.g.:
RxPath yourPath;
Host.Local.Element.FindFromPoint(Ranorex.Mouse.Position, out yourPath);
Regards,
Peter
Ranorex Support Team

Re: Getting Ranorex Xpath of Controls

Posted: Thu Apr 01, 2010 4:07 pm
by KeySam
Thanks alot that works fine