Ranorex Studio finds control that is not there

Ask general questions here.
stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Ranorex Studio finds control that is not there

Post by stapes » Wed Jun 22, 2016 5:50 pm

I am running tests on an iOS app.

In one test, I look for a warning message - it has this format in the repository:
container/container/container/container/table/container[@accessibilitylabel='Uploads']/container/
picture[@accessibilityid='warning.png']
here is my code:

Code: Select all

int intTimeOut=5000;
if(Common .RepoItemInfo .WaitForControl (
    repo.IOS365Agile.Com365agileEnterprise365AgileTEST.LayoutContainer.WarningPngInfo,
    intTimeOut,"Warning Triangle found.",false ,""))
    {
I have spoken to the developer. he says picture is there but it is hidden?

I am only interested in finding it if it is visible.

How do I go about this?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex Studio finds control that is not there

Post by odklizec » Wed Jun 22, 2016 5:55 pm

Hi,

Try add @visible='True' to the repo item xpath, like this...
picture[@accessibilityid='warning.png' and @visible='True']
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: Ranorex Studio finds control that is not there

Post by stapes » Wed Jun 22, 2016 6:07 pm

Thanks. That does the trick.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex Studio finds control that is not there

Post by odklizec » Wed Jun 22, 2016 6:16 pm

Nice to hear that. You see, you should always review recorded xpaths and even those you created manually, if they are unique. One xpath can return multiple items and Ranorex always picks the first one found, which does not necessarily needs to be the expected one ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: Ranorex Studio finds control that is not there

Post by stapes » Thu Jun 23, 2016 3:46 pm

On retrying this test today it does not work.

The Xpath is currently defined as:

Code: Select all

container/container/container/container/table/container[@accessibilitylabel='Uploads']/container/picture[@accessibilityid='warning.png' and @visible='True']
My code is unchanged:

Code: Select all

if(Common .RepoItemInfo .WaitForControl (
        		repo.IOS365Agile.Com365agileEnterprise365AgileTEST.LayoutContainer.WarningPngInfo,
        		intTimeOut,"Warning Triangle found.",false ,""))
        		{
The Warning Triangle is definitely not visible, but this code thinks it is there?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Ranorex Studio finds control that is not there

Post by odklizec » Thu Jun 23, 2016 5:44 pm

Have you tried to search the xpath with spy? If Ranorex thinks there is an element on given xpath, then there most probably is an element available. Could you please upload a Ranorex snapshot from your app (taken in state when you think the control is not visible, but Ranorex thinks there is an element available).
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

stapes
Posts: 206
Joined: Wed Sep 16, 2015 10:55 am

Re: Ranorex Studio finds control that is not there

Post by stapes » Fri Jun 24, 2016 10:07 am

Thank you. I found the element using the spy & the image had changed. I think I can resolve this problem using the image based validation.
The error that was causing that Warning triangle to appear has been fixed for now, so I cannot currently test finding it - I was expecting to not find it.
Instead I can compare the image in WarningPng with the one currently being presented.

Code: Select all

Validate.CompareImage(repo.IOS365Agile.Com365agileEnterprise365AgileTEST.LayoutContainer.WarningPng1Info, WarningPng1_Screenshot1, WarningPng1_Screenshot1_Options);
          
Also used the settings shown in this article (See Enabling Enhanced Reporting Features): http://www.ranorex.com/blog/enhanced-fe ... alidation/