Getting Ranorex Xpath of Controls

Ranorex Spy, Recorder, and Studio.
KeySam
Posts: 15
Joined: Tue Jul 28, 2009 9:52 am

Getting Ranorex Xpath of Controls

Post by KeySam » Thu Apr 01, 2010 7:43 am

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

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Getting Ranorex Xpath of Controls

Post by Support Team » Thu Apr 01, 2010 3:48 pm

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
.
Image

KeySam
Posts: 15
Joined: Tue Jul 28, 2009 9:52 am

Re: Getting Ranorex Xpath of Controls

Post by KeySam » Thu Apr 01, 2010 4:07 pm

Thanks alot that works fine