Identify control by coordinates only?

Ranorex Studio, Spy, Recorder, and Driver.
JeffreyTucker
Posts: 2
Joined: Tue Apr 01, 2008 8:34 pm
Location: Newton, MA
Contact:

Identify control by coordinates only?

Post by JeffreyTucker » Tue Apr 01, 2008 8:46 pm

Can the recorder be made to identify a control based upon only its relative window position? We have a problem with a third party control that always changes its attributes (ControlID/role) and displays as an image that is clickable.
Thanks.

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

Post by Support Team » Wed Apr 02, 2008 9:27 am

In fact, the RanorexRecorder should already do that if it can't find the control and the corresponding element otherwise.

What do you mean with "always changes its attributes"? Do the attributes change at runtime or after a restart of the application?

Regards,
Alex
Ranorex Support Team

JeffreyTucker
Posts: 2
Joined: Tue Apr 01, 2008 8:34 pm
Location: Newton, MA
Contact:

Identify control by coordinates only?

Post by JeffreyTucker » Fri Apr 04, 2008 5:14 pm

Apparently the control actually does change its attributes at runtime. We can see them change each time we hit the form.
I noticed that you claim that you do not record mouse moves, but only clicks. So I tried to click within the window that has the image control (that is giving us trouble), then clicking the image button. That seemed to work to the point where I could get all the way through a recording session and play it back. Is this a valid way to proceed in this case?


We have an multimedia interview application that locks out the keyboard while the interview is on-going. Only the mouse is allowed. We would like to automate testing with the recorded C# script merged with and driven by NUnit tests. Have you done this sort of thing before?

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

Post by Support Team » Mon Apr 07, 2008 12:53 pm

JeffreyTucker wrote:Is this a valid way to proceed in this case?
Actually, clicking on the control should be sufficient since the RanorexRecorder activates/brings the corresponding form to front before searching for the control. But if it works that way ... :)

We have a couple of customers using NUnit and Ranorex, and use NUnit ourselves. The one thing you might run into is setting the ApartmentState of the NUnit thread to STA. Usually, NUnit runs the testing thread with an MTA apartment state while Ranorex assumes STA (and requires STA for web automation). So, if you experience problems running you Ranorex scripts via NUnit, configure NUnit to use STA.

An instruction on how to do that can be found here:
http://www.hedgate.net/articles/2007/01 ... unit-test/
The first option is to place a config file in the same directory as you NUnit test library DLL. The second option is to create a new thread with STA in every test method calling Ranorex.

Regards,
Alex
Ranorex Support Team