Page 1 of 1

Unnecessary Scroll when identifying elements.

Posted: Tue May 06, 2014 11:53 am
by brgibb
Hi,

I wonder if anyone can help me with this issue I experience.

I have a website developed using the Keenthemes template (http://www.keenthemes.com/preview/index.php?)

In one of the pages there are a few tabs. By default on page load the first tab is the one that is active.

When automating I wish to check which tab is currently selected and if it is the one I want then do nothing and carry on.... otherwise I wish to click the tab to select it...then carry on.

So if the summary tab is selected and I wish to get to the features tab I simply check:

Code: Select all

if RxPathToFeaturesTab.Class != "active")
{
      RxPathToFeaturesTab.Click();
}

However if the condition is met and the tab is to be clicked Ranorex Scrolls up at the point of clicking so much so that much of the tab is hidden underneath the black header bar and can't be clicked. There is no need to scroll as the tab is clearly in view already?!?!?

Currently I am working round this by using:

Code: Select all

.Click(Location.LowerCenter);
.... as Ranorex can still see the bottom part of the element.

I have tried

Code: Select all

EnsureVisible()
,

Code: Select all

UseEnsurevisable = true
,

Code: Select all

Focus()
with no luck. Incidentally if I use

Code: Select all

.PerformClick()
the page is not scrolled but the tab is not selected either.

Can anyone tell me why this scrolling happens and how to get round it as I suspect this will happen in other areas of the Interface.

Thanks in Advance.

Re: Unnecessary Scroll when identifying elements.

Posted: Tue May 06, 2014 1:56 pm
by krstcs
I would guess that Ensure Visible is what is actually causing this. You probably have the repo and/or this object set to use Ensure Visible by default. Try turning it off and see what happens then.

For some reason, sometimes the Ensure Visible routine wants to scroll even when it doesn't need to.

Re: Unnecessary Scroll when identifying elements.

Posted: Tue May 06, 2014 4:13 pm
by brgibb
Hi krstcs,

Do you mean like this for a one time operation against that element?

Code: Select all

if RxPathToFeaturesTab.Class != "active")
{
      RxPathToFeaturesTab.UseEnsureVisible = false;
      RxPathToFeaturesTab.Click();
}

Re: Unnecessary Scroll when identifying elements.

Posted: Tue May 06, 2014 5:40 pm
by krstcs
Yes, but you will need to also set it back to true afterwards.

Code: Select all

if RxPathToFeaturesTab.Class != "active")
{
      RxPathToFeaturesTab.UseEnsureVisible = false;
      RxPathToFeaturesTab.Click();
      RxPathToFeaturesTab.UseEnsureVisible = true;
}

Re: Unnecessary Scroll when identifying elements.

Posted: Wed May 07, 2014 9:04 am
by brgibb
Yip - I tried that but no difference in the behavior. The scroll still occurs....

Re: Unnecessary Scroll when identifying elements.

Posted: Wed May 07, 2014 2:10 pm
by krstcs
You might try turning it off for all parent elements of the one in question, as well. It might be one of those that is doing it.

Re: Unnecessary Scroll when identifying elements.

Posted: Wed May 07, 2014 4:19 pm
by brgibb
Thanks for the suggestion. I tried setting it to false for all parent elements from the Dom downwards to the element I want to click.... but alas same behaviour.

I can work round the issue for now but I know that in other areas of my interface this is going to cause me a real headache and quite unreliable.

:-/

Re: Unnecessary Scroll when identifying elements.

Posted: Wed May 07, 2014 4:25 pm
by mzperix
Did you try to turn off the ensure visible for all elements in Ranorex Studio? It is found in General Settings.

Re: Unnecessary Scroll when identifying elements.

Posted: Fri May 09, 2014 9:21 am
by brgibb
I'm not using the studio - simply coding C# using the Ranorex libraries.

Anyone from Ranorex know a workaround to this?

Re: Unnecessary Scroll when identifying elements.

Posted: Mon May 12, 2014 3:23 pm
by Support Team
Hi,

Please uncheck the Ensure Visible by default setting in Ranorex Studio or directly in the RanorexConfigX.xml file which can be found here: "%AppData%".
In the config you need to set the following setting to false:
<adapter.defaultuseensurevisible>
		False
</adapter.defaultuseensurevisible>
Does it work after you set it to false?

Regards,
Markus

Re: Unnecessary Scroll when identifying elements.

Posted: Tue May 13, 2014 9:17 am
by brgibb
Hi Markus,

Yes - indeed it does now click the element without any random scrolling. :-)

I have to say I would never have found that file..... thanks.

Can you explain (for my understanding) why the scrolling takes in place when the defaultuseensurevisible = True. It seems odd that it happens at all when the required element is clearly in view.

Re: Unnecessary Scroll when identifying elements.

Posted: Wed May 14, 2014 2:25 pm
by Support Team
Hi,

I am glad it works now :)!

This depends very much on the used technology, in general we try to check if the element is in the visible area respectively tell the application to check if the element is in the visible area or to bring it in the visible area. But Ranorex has not the full control of the action since it also depends on the application and technology which executes the action. In addition visible doesn't mean that it is always shown to the user, it can also mean that it is just rendered but not yet presented.

Regards,
Markus

Re: Unnecessary Scroll when identifying elements.

Posted: Wed May 21, 2014 11:14 am
by brgibb
Hmmmm......

You see the issue in have now is the opposite.....

Setting:

Code: Select all

<adapter.defaultuseensurevisible>  
        False  
</adapter.defaultuseensurevisible>
..means that is an element is off screen ...that would I'd ordinarily need to scroll to get to..... it will not scroll to find it, before performing an action on it......clicking etc.

So it seems that either there is unnecessary scrolling which pushes a desired element off screen OR the there is not scrolling at all and thus a desired element remains off screen.

In both cases the action cannot be taken.

There must be some workaround to this......?

Re: Unnecessary Scroll when identifying elements.

Posted: Thu May 22, 2014 4:24 pm
by Support Team
Hi,

Do you use the repository or do you directly create your adapters in code?

One possible way would be using EnsureVisible for items which are invisible:
yourAdapter.EnsureVisible();
Regards,
Markus