Discrepancy between Repository object and hard coded XPath

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
wiktor.pajor
Posts: 3
Joined: Thu Apr 24, 2014 3:54 pm

Discrepancy between Repository object and hard coded XPath

Post by wiktor.pajor » Wed Apr 30, 2014 3:27 pm

I have a repository item named CreateRx. When highlighted, this control is found without any problems.
When executing a simple click command on the same item, Ranorex finds another control in the application that is not in the same XPath.
Executing the same script, but with a hard coded XPath from the Repository, it finds the right control.

Repository Item
Ubik Base: "/form[@automationid='c92f2fb4abc249f98b2165ad8d529a31']"
Rooted Folder: FooterPanel
CreateRx: "toolbar[@automationid='639bddcdc6684543b02f3ed6f45a4807']/button[3]"

Code: Select all

var createRx = repo.Ubik.FooterPanel.CreateRx;
createRx.Click();

Code: Select all

Button createRxButton = repo.Ubik.AbsoluteBasePath.ToString() + "/toolbar[@automationid='639bddcdc6684543b02f3ed6f45a4807']/button[3]";
createRxButton.Click();
This is the control that Ranorex finds that is not correct:

Code: Select all

toolbar[@automationid='670fb5b849cb414aadada24cf0945f62']/button[2]
Any suggestions ?

Ranorex V. 5.0.2.17874
.Net Runtime Version 4.0.30319.18444
Windows 7 64bits
Attachments
4-30-2014 10-04-27 AM.png
Repository Image
4-30-2014 10-04-27 AM.png (36.83 KiB) Viewed 913 times
ubik.rxsnp
Snapshot
(172.1 KiB) Downloaded 103 times

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

Re: Discrepancy between Repository object and hard coded XPath

Post by Support Team » Tue May 06, 2014 9:28 am

Hello wiktor.pajor,

Unfortunately I’m not exactly sure what’s causing this behavior, but I suggest that you modify your RxPath so you don’t need an index in order to identify the button.

You can use the text field that is stored as a child node of the button for identification.

E.g.:
/form[@automationid='c92f2fb4abc249f98b2165ad8d529a31']/toolbar[@automationid='639bddcdc6684543b02f3ed6f45a4807']/?/?/text[@name='Créer Rx']/..
This path refers to the parent element of the text field 'Créer Rx' which is equivalent to:
../toolbar[@automationid='639bddcdc6684543b02f3ed6f45a4807']/button[3]
Please let me know if that’s a suitable solution for you. :)

Regards,
Robert
.
Image

wiktor.pajor
Posts: 3
Joined: Thu Apr 24, 2014 3:54 pm

Re: Discrepancy between Repository object and hard coded XPath

Post by wiktor.pajor » Mon Nov 03, 2014 3:35 pm

Hello Robert,

Sorry for the long reply delay.
This information migh be useful for someone.

I have Ranorex 5.0.2.17874 installed.

Refimid is located in the file .rxrep

This was my case where the search control failed.

Code: Select all

<item
name="SaveRx"
id="e90f9c55-8f48-4807-a55b-75dd36d3e0e6"
searchtimeout="30000ms"
capname="button"
refpath="/form[@automationid='c92f2fb4abc249f98b2165ad8d529a31']/toolbar[2]/button[@automationid='f20d7ebdb11447c8bcff9dc3455c94f7']"
addcaps="button,uiautomation,uiautomationinvoke"
refimgid="667695f7-4e59-4c7c-8985-29d7601a608b">
                /form[@automationid='c92f2fb4abc249f98b2165ad8d529a31']/?/?/button[@automationid='f20d7ebdb11447c8bcff9dc3455c94f7']
</item>
When I changed automationid='f20d7ebdb11447c8bcff9dc3455c94f7' to another id, the highlighting was fine.
refpath was also changed and it looks that everything was fine.
But, the toolbar id also changed and this made is impossible to find it at runtime.

This is the final control after the refactoring and putting “Simple” as the Ranorex XPath generation mode

Code: Select all

<item
name="SaveRx"
id="e90f9c55-8f48-4807-a55b-75dd36d3e0e6"
searchtimeout="30000ms"
capname="button"
addcaps="button,uiautomation,uiautomationinvoke"
refimgid="bcca3ffa-e44a-4b89-b2b8-238eb09d3064">
                /form[@automationid='c92f2fb4abc249f98b2165ad8d529a31']/toolbar[@automationid='5263a93a2e314639bf59272b83eaa16c']/button[@automationid='f20d7ebdb11447c8bcff9dc3455c94f7']
</item>
<item
We can see that this id is now explicit and looking at the right button.

You can correct me if I’m wrong, but it looks like the highlight from Spy or Ranorex Studio is not using the same path at runtime.

If this is the case, I don’t mind the different paths, but a warning or something that shows me that the paths might not match.

Wiktor

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

Re: Discrepancy between Repository object and hard coded XPath

Post by Support Team » Wed Nov 05, 2014 2:06 pm

Hello Wiktor,

May I ask you to contact [email protected]? We would like to analyze this issue in more detail.

Regards,
Robert
.
Image