Mapping of Ranorex Spy Elements against Repository

Ranorex Spy, Recorder, and Studio.
adriannaiman
Posts: 2
Joined: Wed Jun 08, 2011 1:20 pm

Mapping of Ranorex Spy Elements against Repository

Post by adriannaiman » Wed Jun 08, 2011 2:02 pm

Hi,

I am pretty new to automation and Ranorex. While evaluating some tools for my company I have installed and tried Ranorex. I generated a few recordings, most of which worked well, until I've restarted the Ranorex app, meaning that it was closed and used later on. What I'm trying to say is that after I restarted the app and tried to playback the recordings it failed at certain elements.

I started to use the Spy tool and the Repository, and noticed that I can add particular elements (including children) to Repository. I also noticed that I can add actions to my script without making any recordings. For example I tracked down in Spy an UI element with the id 173 024 216. This UI element had a child element 173 024 776 which is basically a list with 3 items. I added 173 024 216 including its list child to repository.I've also added some new actions to my recording based on clicks on this element - 173 024 776. All worked well until I've restarted the entire Ranorex app again (just to use it again later). I didn't make any changes and any intended ones were saved. When opened up app later on, the recording fails during playback when reaching the elements above that I've mentioned. When opened the Spy tool I'm seeing that the parent element is now 130 246 664 and its child 173 024 776 is now 173 484 648. The fail in log file indicates that it doesn't actually find the initial parent element 173 024 216. I will paste the error from the log below, and will also add snap shots. My questions are:

1) What has caused the initial elements to change from 173 024 216(parent) and 173 024 776(child) respectively to 130 246 664(new parent) and 173 484 648(new child) in Spy tool? Presumably, if it's changed in Spy, that's why the recording playback doesn't find them anymore.
2)I'm new to this, but am I doing something wrong here? I need to find a tool to automate our apps UI which is pretty heavy. I can't rely only on record & playback, and adding elements from Spy -> to Repository, then using them for the actions in the code seemed like a valid and quite useful solution. Eventually labeling them and cleaning/keeping a clean Repository would also be helpful. Any suggestions or advice?
3)Any other way to do this?

Thanks in Advance,
Adrian

"Failed to find item 'AuroraRepository.FormAurora_TOUCH.ElementN173024216.ListList1' within the specified timeout of 30s. The folder 'AuroraRepository.FormAurora_TOUCH.ElementN173024216' was not found within the specified timeout of 30s. No element found for path 'container/container[@controlname='WorkingArea']/container[@controlname='Enter_PlateDetails_Add']/form/element[@controlid='173024216']' within 30s. "
Attachments
Ran2.png
Ran2.png (126.14 KiB) Viewed 1273 times
ran1.png
ran1.png (176.53 KiB) Viewed 1273 times

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

Re: Mapping of Ranorex Spy Elements against Repository

Post by Support Team » Wed Jun 08, 2011 3:09 pm

Hi,

It seems that some attributes of your elements (controlid) changes after each restart of your application, this is because of the old VB 6 Forms.
In this case you can eliminate the "controlid" out of your RxPath.
Instead of:
element[@controlid='173024776]/element/list/listitem[@accessiblename='HCV assay']

You can use this:
element/element/list/listitem[@accessiblename='HCV assay']

Ranorex will find the right object because the "accessiblename" is an unique attribute of the specific element and so the RxPath is unique.

The following link shows how you can eliminate such dynamically generated attributes out of your solution:
http://www.ranorex.com/blog/eliminate-d ... norexpaths

For a better understanding of the RanorexPath please have a look at following link:
http://www.ranorex.com/support/user-gui ... xpath.html

For a better understanding of Ranorex please have a look at our User Guide:
http://www.ranorex.com/support/user-guide-20.html

Regards,
Markus
Ranorex Support Team
.
Image

adriannaiman
Posts: 2
Joined: Wed Jun 08, 2011 1:20 pm

Re: Mapping of Ranorex Spy Elements against Repository

Post by adriannaiman » Wed Jun 08, 2011 4:03 pm

Hi Markus,

Thanks much for your prompt reply. I tried to do the suggested change, meaning that: in the Repository, for the foregoing element I've edited the path and simply eliminated the id.

element[@controlid='173024776]/element/list/listitem[@accessiblename='HCV assay'] resulted in element/element/list/listitem[@accessiblename='HCV assay']. However, I ran the script and it stops again:

"Failed to find item 'AuroraRepository.FormAurora_TOUCH.ElementN173024216.List' within the specified timeout of 30s. " - this is in the log file, meaning that it still searched for that initial parent element - 173024216. I'm also seeing references to this element in the *cs file: Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'FormAurora_TOUCH.ElementN173024216.HCV_assay' at Center.", repo.FormAurora_TOUCH.ElementN173024216.HCV_assayInfo, new RecordItemIndex(9));

I'm wondering if I should change the RxPaths for all the elements in the tree in the Repository, all the way to my element listitem[@accessiblename='HCV assay']. By this I mean that the root element in the repository has the path: container/container[@controlname='WorkingArea']/container[@controlname='Enter_PlateDetails_Add']/form/element[@controlid='173024216']. Should this be changed to container/container[@controlname='WorkingArea']/container[@controlname='Enter_PlateDetails_Add']/form/element ?

And the next element's path in the tree, right above HCV assay, element[@controlid='173024776'] - should the path be changed to just 'element' ?


Beside changing the paths in the right, in the Repository Window, do I also need to change the names under the 'Item' in the left part?

Also, the link for changing dynamically generated Attributes is for Ranorex2.0. Can I try it on my trial Ranorex 3.0?

Thanks very much,
Adrian

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

Re: Mapping of Ranorex Spy Elements against Repository

Post by Support Team » Wed Jun 08, 2011 5:12 pm

Hi,

The failure appears because you have another RxPath with one element which contains a "controlid" attribute.

Yes all these elements should be changed to "element" without the "controlid" attribute if the resulting RxPath is still unique. A more comfortable way to change all these elements is when you work with the "RxPathWeights", which are mentioned in the blog.
You are right the blog describes it in a way you have done it in the old version, but you can still use it like it is mentioned. Or you can also edit the weights directly in the Spy, see attachment.

No you have not to edit the name of the items.

Regards,
Markus
Ranorex Support Team
Attachments
EditRxPathWeights.png
EditRxPathWeights.png (188.37 KiB) Viewed 1240 times
.
Image