BUG: Unique ID (#) not being found even though it exists

Bug reports.
krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

BUG: Unique ID (#) not being found even though it exists

Post by krstcs » Tue May 13, 2014 10:07 pm

Ranorex 5.0.3
Windows 7
Website: http://www.containerstore.com/welcome.htm

NOTE: ALL tests are failing due to this when using 5.0.3. I am going to attempt to roll back to 5.0.2 tomorrow.

The following xpath is not found even though it is accurate, worked before, and the object exists. I can change the "#" to "@id=" and it works fine. I can also add the intermediate div between the 'bodyContentContainer' and 'header' divs and it works. But if I use the Unique ID with \\ before the div, it does not work. This worked fine in 5.0.2 and previous.

Code: Select all

XSpy (and the test) will not find:
/dom[@domain='www.containerstore.com' and @state='complete']//div[#'bodyContentContainer']//div[#'header']

XSpy will find any of these:
/dom[@domain='www.containerstore.com' and @state='complete']//div[#'bodyContentContainer']//div[@id='header']
/dom[@domain='www.containerstore.com' and @state='complete']//div[#'bodyContentContainer']/div/div[#'header']
/dom[@domain='www.containerstore.com' and @state='complete']//div[#'bodyContentContainer']/div[#'topNavigation']/div[#'header']
Shortcuts usually aren't...

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

Re: BUG: Unique ID (#) not being found even though it exists

Post by Support Team » Wed May 14, 2014 2:04 pm

Hello krstcs,

Thank you for reporting the bug.
We are very sorry for the inconvenience this may have caused. Unfortunately a performance optimization in the unique ID search feature exposed a bug in the underlying browser implementations which was not caught by our internal tests. We are working on the problem and will let you know once a new build of Ranorex 5.0.3 is released. The current 5.0.3 version was temporarily removed from our servers. Meanwhile, please roll back to Ranorex 5.0.2 available for download here.

Thank you for your understanding.

Regards,
Bernhard

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

Re: BUG: Unique ID (#) not being found even though it exists

Post by Support Team » Mon May 19, 2014 3:06 pm

Hello krstcs,

The bug in version 5.0.3 is fixed now. The version is online again and can be downloaded from our
download archive.
Thanks again for reporting the bug so fast.

Regards,
Bernhard

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: BUG: Unique ID (#) not being found even though it exists

Post by krstcs » Mon May 19, 2014 8:29 pm

Thanks Bernhard,

I've been testing it on a couple of systems and it acts much better now! :D
Shortcuts usually aren't...

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

Re: BUG: Unique ID (#) not being found even though it exists

Post by Support Team » Tue May 20, 2014 2:30 pm

Hi krstcs,

That sounds good. Thank you for the information.

Regards,
Bernhard

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: BUG: Unique ID (#) not being found even though it exists

Post by krstcs » Tue May 20, 2014 3:52 pm

OK, I hate to be the bearer of bad news, but...

While one instance was fixed (our eCommerce site), I have another instance (internal web-app) with a similar issue. However, one computer finds the object (my local system), but another doesn't (the VM test bed). Same exact object and test, all on the same setup:

Ranorex 5.0.3
Windows 7
Chrome 34 (what this app runs on, so I can't check with other browsers).

No unique ID can be found if it is the only object in the path after the dom.

So the following cannot be found:
/dom[@domain='testdomain']//div[#'myDiv']

But, all of these can be found. Same object, same system, just different path:
/dom[@domain='testdomain']//div[@id='myDiv'] (notice the use of "@id=" instead of "#", only 1 is found)
/dom[@domain='testdomain']//div/div[#'myDiv'] (extra div)
/dom[@domain='testdomain']//div//div[#'myDiv']
/dom[@domain='testdomain']//div[#'myOtherDiv']//div[#'myDiv']

Unfortunately, I can't give access to the app that this is happening on.

Fortunately, this is a small test so I was able to refactor the repository a bit to make it work everywhere, so it isn't a stopper like the original one was. However, everyone may not be as fortunate.
Shortcuts usually aren't...

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

Re: BUG: Unique ID (#) not being found even though it exists

Post by Support Team » Wed May 21, 2014 3:31 pm

Hello krstcs,

Thank you for describing your issue and thank you for the snapshot files you provided via email.
In you snapshot I can see that your website contains an iframe. The problem is that there are two different scopes if there is an iframe available. The "DOM scope" and the "IFrame" scope.

If you are using the following path Ranorex searches the element within the "DOM scope"
"/dom[@domain='testdomain']//div[#'myDiv']"
Ranorex cannot find the element because it is only available in the "Iframe scope"
That's the reason why you have to define in which scope Ranorex should search for the element.
For example:
/dom[@domain='testdomain']//iframe//div[#'myDiv']
I tried to reproduce the issue using a sample website, but could not reproduce the behavior concerning your additional RanorexPaths. If I add a "div" in between the "/dom[@domain='testdomain']" and the "div[#'myDiv']" Ranorex is also not able to find the element.

I mean for example this RanoreXPath:
/dom[@domain='testdomain']//div//div[#'myDiv']
Please let me know if I understand something wrong.

Regards,
Bernhard

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: BUG: Unique ID (#) not being found even though it exists

Post by krstcs » Fri May 23, 2014 1:33 pm

Thank you Bernhard, I did not realize that iFrames cause these kinds of issues.

Part of the problem is that the short path (without the iframe) worked before upgrading to 5.0.3, so I expected it to continue to work. Were the changes made to that unique id algorithm part of the reason for this change in behavior?

As for the //div// working, I don't know why, but it does on my systems. But then, on my local system the short path still works for some reason. Could be due to my system not being virtualized while the test systems are VMs.

I have since put a rooted folder in the repo for the iFrame and moved all of the elements that are in that frame under the folder. That has, indeed, fixed the issue. Fortunately this was a small test so it wasn't too difficult.
Shortcuts usually aren't...

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

Re: BUG: Unique ID (#) not being found even though it exists

Post by Support Team » Mon May 26, 2014 4:21 pm

Hi krstcs,

If the setting "Enable search by unique ID" is disabled a fallback mechanism will be used to find the element.
I am not sure, but I don't believe that you have disabled this setting on your machine. Am I right? Unfortunately I have no other idea at the moment why the behavior is different on your physical machine and on the VM.

Regards,
Bernhard

krstcs
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: BUG: Unique ID (#) not being found even though it exists

Post by krstcs » Tue May 27, 2014 1:46 pm

Correct, I have not disabled the "Enable search by unique ID" setting.

I thought it was strange as well, that's why I didn't thing the iFrame was the problem originally.

Anyway, I have changed my XPaths to include the iFrame now so it works all the time.
Shortcuts usually aren't...