Exports C++ code without the coordinate dependecy.

Ranorex Studio, Spy, Recorder, and Driver.
Posts: 1
Joined: Thu Mar 06, 2008 1:40 pm

Exports C++ code without the coordinate dependecy.

Post by Marcin81 » Thu Mar 06, 2008 2:15 pm

The recorder has created C++ code after we have played scenario.
But this code often uses coordinate points to take an ElementStruct.

Code: Select all

if ( RxElementFindChildLocation(&controlElement, 12, "Clipboard",
  NULL, 142, -10, &element) != TRUE)
  return 1;
And generally the code generated by recorder is dependent on coordinate
gui elements.

Code: Select all

if ( RxMouseMoveToControl(control,113, 11, 40) != 0 )
  return 1;
RxMouseGetPosition((int*)&point.x, (int*)&point.y);
RxMouseMove(point.x+-116, point.y+7, 137);
1. Is it possible for the recorder to not use coordinate points when it
exports to C++ code ?
2. I know I can use the toolbox to inspect the gui elements that the
test application should visit but then the C++ code must be written
manually. I played with trying to use constant ID with the widgets in
one of my tested application but without much luck. Is there a way to
change the code in a tested application so the recorder exports C++
code without the coordinate dependecy?

Posts: 49
Joined: Fri Oct 26, 2007 9:38 pm
Location: Texas

no coordinates for Python either (and other languages)

Post by jasong » Fri Mar 07, 2008 3:34 pm

I post process all my scripts to remove the coordinates and eliminate the mouse movement speed.

The way I view it now, there are two modes I could use the recorded scripts as:
1. Demo/training - in which I want the mouse movement and adjustable speed (perhaps from a variable at the beginning of the script
2. testing - in which I do not want any slowness or movement, I want to complete the tests as fast as possible

a caveat to #2 is that due to our database variances in speed, sometimes certain forms take a while to pop up. In those cases I poll for the form with an optional timeout (optional, because you can set it globally).

Once this is complete, and variables put in place of hard coded values then the scripts are VERY reusable.


User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: Exports C++ code without the coordinate dependecy.

Post by Support Team » Fri Mar 07, 2008 3:45 pm

Marcin81 wrote:And generally the code generated by recorder is dependent on coordinate gui elements.
Generally, the recorder tries to avoid using coordinates alone when computing the position for mouse actions. However, coordinates are usually taken as a hint when searching for controls/elements or they mark an offset inside a control/element to further specify the point to click on an control/element.
When replaying, the recorder first tries to find an element including its recorded coordinates. If not successful, it will try searching again without coordinates. If successful without coordinates only, the generated code will leave out coordinats, too.
Using coordinates alone to find the position of a mouse click is only a fallback.

Currently, the recorder will always first try to use coordinates as hints. The option to disable this behavior is on our feature list.

Ranorex Support Team