Tracking a form that changes title name

Ranorex Studio, Spy, Recorder, and Driver.
Posts: 5
Joined: Fri Jan 30, 2009 12:46 am

Tracking a form that changes title name

Post by cnimnicht » Fri Jan 30, 2009 12:55 am


I am currentely evalutating Ranorex for my company, we have a product that opens with a title name "Form". When you load a file with this product the title changes to Form - FileName. The problem I am having is that when I use Ranorex Spy on the application after I load a file, it creates a new /Form, so that if I save it to the Element Repository I will now have 2 /Forms, /form[@title='Form'] and /form[@title='Form - FileName'].

What can I do to work around this problem?

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

Post by Support Team » Fri Jan 30, 2009 10:57 am

The solution for your problem is easy: Search for the application form once and then use this Form instance from then on to search elements inside you application using relative RxPaths. The RanorexRecorder and the repository generated by the recorder work similar (if the "UseCache" property of the application folder is enabled). So, when you generate repositories using RanorexRecorder or RanorexSpy, elements in the same application should be listed in the same application folder, regardless of the application title.

If you use the RanorexSpy alone without repositories, you get relative paths to elements inside you application by right-clicking on the application element and selecting "Set Element as Root". From then on RanorexSpy will generate paths relative to the application element/folder. So, if you don't use repositories, you will need to write code like that:

Code: Select all

Form form = "/form[@title='Form']";
Button button = form.FindSingle<Button>("relativePathToButton");
Ranorex Support Team