Anchor a test to a field rather than screen location?

Ranorex Studio, Spy, Recorder, and Driver.
Chris Wright
Posts: 25
Joined: Tue Mar 08, 2011 11:07 am

Anchor a test to a field rather than screen location?

Post by Chris Wright » Mon Mar 14, 2011 3:47 pm

Hi,

I have been creating some auto tests with Ranorex against an application that has several modal windows. Some of the modal windows do not appear consistantly in the same screen location, therefore the auto test then fails as its based on mouse clicks in relation to screen location.

Is it possible to set a mouseclick against a field within the application rather than the screen location?

Regards
Chris

User avatar
Ciege
Posts: 1336
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Anchor a test to a field rather than screen location?

Post by Ciege » Mon Mar 14, 2011 4:52 pm

Hmm, by default I do not think Ranorex is coordinate based... You may want to share your code so we can see exactly what it is you are doing.

But yes, you can tell Ranorex to click on a certain field.

For example here is code to click on a textbox wherever it may live:

Code: Select all

Ranorex.Text HDtext = RanorexFormName.FindSingle(".//text[@accessiblename='" + TextBoxName + "']", 30000);
HDtext.Click(Location.Center);
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

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

Re: Anchor a test to a field rather than screen location?

Post by Support Team » Mon Mar 14, 2011 7:51 pm

Ciege is right, Ranorex is *not* coordinate based by default.
The recorder always records the exact click location relative to the *best* element ("field") Ranorex can identify, for example a button or a text box, but the values are not relevant in most cases and this behavior can be turned off.

If there are issues with object recognition the "best" element might be a window or some container control.
If you could post a Ranorex Snapshot (rxsnp) file of your application, we might be able to help you with that issue. (if you do not want to post it in the forum, you can also send it to [email protected])

Michael
Ranorex Team

Chris Wright
Posts: 25
Joined: Tue Mar 08, 2011 11:07 am

Re: Anchor a test to a field rather than screen location?

Post by Chris Wright » Mon Mar 21, 2011 10:05 am

Hi Michael,

I have a 'rxsln' file for the actual recording but cannot see a 'rxsnp' file??

Regards
Chris

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

Re: Anchor a test to a field rather than screen location?

Post by Support Team » Mon Mar 21, 2011 11:24 am

Hi Chris,
Chris Wright wrote:but cannot see a 'rxsnp' file??
A rxsnp file is a Ranorex Snapshot file. This is not placed at the recording location, but rather you have to create one. Therefore please see following link http://www.ranorex.com/support/user-gui ... files.html

Regards,
Peter
Ranorex Team

Chris Wright
Posts: 25
Joined: Tue Mar 08, 2011 11:07 am

Re: Anchor a test to a field rather than screen location?

Post by Chris Wright » Mon Mar 21, 2011 4:30 pm

Hi Peter,

Many thanks for your response.

Does creating a snapshot work for an entire recording?? I cannot get this to work at present following the user notes.

Regards
Chris

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

Re: Anchor a test to a field rather than screen location?

Post by Support Team » Tue Mar 22, 2011 9:40 am

Hi,

thus you can't generate snapshot files covering your whole system under test, but only for one application under test, it's only possible to generate a snapshot file covering your whole recording, if your recordinge only interacts with one application. But if there are more than one applications interacting you can send us snapshot files for all of these applications.

Kind regards,
Tobias
Support Team