Making the script coordinates independent

Ask general questions here.
Kalina
Posts: 1
Joined: Wed Mar 17, 2010 3:30 pm

Making the script coordinates independent

Post by Kalina » Wed Mar 17, 2010 3:51 pm

How do i make the scripts co ordinates independent...

eg: when the item is clicked it generates the coordinates like 142;54 and next time I run it the it fails to click at the area with specified coordinates value.

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

Re: Making the script coordinates independent

Post by Support Team » Thu Mar 18, 2010 10:05 pm

Ranorex uses coordinates for relative positions inside UI elements only. That means, when doing a mouse click on an item, we search for a UI element by its RanoreXPath. Ranorex then gets the screen position from the item and uses the coordinates only to further specify the click position relative to the element bounds.

You can change the recorder settings (see http://www.ranorex.com/support/user-gui ... ation.html) to not record relative mouse coordinates ("Record relative element coordinates" setting). That way Ranorex will always click right at the center of the UI element. However, that won't work for all controls, e.g. when some control is only recognized as one big element and you need to click at a defined location inside that element.

It all comes down to how small the elements are that Ranorex can identify by RanoreXPath. You can easily check that by turning on the "Highlight Elements" option (see http://www.ranorex.com/support/user-gui ... html#c2568) in Ranorex Spy. The smaller the elements are, the more coordinate independent your scripts will be.

As an alternative you can use Image Based automation to specify where to click inside an element (see http://www.ranorex.com/support/user-gui ... ation.html).

Regards,
Alex
Ranorex Support Team
.
Image