Page 1 of 1

Ranorex Spy "Track" API

Posted: Thu Jan 04, 2018 5:02 pm
by aromney
I'd like an API to begin the "Track" process normally performed through a manual Ranorex Spy GUI button press. This would allow my application to get a RanoreXPath from a mouse click on a UI element. Additionally, it'd be nice to also be able to use Ranorex Spy's GUI highlighting without having to initiate it from Ranorex Spy application GUI.

I think this could be described by an API to:

-Begin Ranorex Spy Tracking
-Callback for UI element object selection/mouse pointer down where the path, at a minimum, is passed to any listeners
-Highlight object at path

Does this already exist?

Re: Ranorex Spy "Track" API

Posted: Fri Jan 05, 2018 2:57 pm
by McTurtle
Hello aromney,

Sure, it exists, that's why Ranorex can do it. However, I am sure that what you are asking for is a Ranorex trade secret and therefore won't be revealed :)

Regards,
McTurtle

Re: Ranorex Spy "Track" API

Posted: Fri Jan 05, 2018 3:31 pm
by odklizec
Hi,

Check this post about highlighting an element via code:
https://www.ranorex.com/forum/is-it-pos ... tml#p39458

However, this post is well over a year old and so the code may need to be updated to make it functional with Ranorex 7 or 8.

Re: Ranorex Spy "Track" API

Posted: Fri Jan 05, 2018 4:22 pm
by krstcs
The PUBLIC API is here Ranorex API Documentation.

If what you are looking for is not in there then it is not supported for use by Ranorex.

I would think that generating a RanoreXPath at runtime would not be terribly difficult, but I wonder why you would need it. It seems to me that there may be a better way to configure your tests so that you don't need this. I do some very technical testing, but I've never needed to get XPaths at runtime, and actually I think it would be better to test if you get the XPaths beforehand.

As for the highlighting, as Pavel said, that has already been discussed and it should still work in 7/8. However, again, I would wonder at the usefulness of such a test feature as normally the point of test automation is to run without a human even looking at it beyond the final reports. It seems to just add a layer of brittle code to your tests that must then be maintained when it may not be actually necessary.

Re: Ranorex Spy "Track" API

Posted: Fri Jan 05, 2018 11:24 pm
by aromney
In retrospect, I should have submitted this topic to "Automation API".
odklizec wrote:Check this post about highlighting an element via code:...
Cool, this answers one of my questions and provides a starting point for the others.
McTurtle wrote:Sure, it exists, that's why Ranorex can do it. However, I am sure that what you are asking for is a Ranorex trade secret and therefore won't be revealed :)
This shouldn't be the case because what I'm asking for does not require knowledge about any inner workings at all. I want a dll that let's me get a small subset of the information provided by the Ranorex Spy application but without the GUI. Definitely no secrets revealed when peeling off a GUI layer.
krstcs wrote:The PUBLIC API is here Ranorex API Documentation.

If what you are looking for is not in there then it is not supported for use by Ranorex.
Noted!

Re: Ranorex Spy "Track" API

Posted: Mon Jan 08, 2018 4:06 pm
by Support Team
Hello aromney,

There is a method available that you could use in order to get an element during runtime based on where your mouse is currently located:
- FindFromPoint: Link

In code the usage could look something like this:
Element button = Host.Current.Element.FindFromPoint(Mouse.Position);
From this, you can then build the RanoreXPath:
RxPath Path=button.GetPath(PathBuildMode.Default);
Available modes: Link

I hope this helps.

Sincerely,
Tomaž