Unnecessary Scroll when identifying elements.

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
brgibb
Posts: 39
Joined: Wed Jun 05, 2013 2:15 pm

Unnecessary Scroll when identifying elements.

Post by brgibb » Tue May 06, 2014 11:53 am

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.
Attachments
Scroll_Issue before click().png
Scroll_Issue before click().png (73.46 KiB) Viewed 1526 times
Scroll_Issue after click().png
Scroll_Issue after click().png (88.26 KiB) Viewed 1526 times

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

Re: Unnecessary Scroll when identifying elements.

Post by krstcs » Tue May 06, 2014 1:56 pm

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.
Shortcuts usually aren't...

brgibb
Posts: 39
Joined: Wed Jun 05, 2013 2:15 pm

Re: Unnecessary Scroll when identifying elements.

Post by brgibb » Tue May 06, 2014 4:13 pm

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();
}

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

Re: Unnecessary Scroll when identifying elements.

Post by krstcs » Tue May 06, 2014 5:40 pm

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;
}
Shortcuts usually aren't...

brgibb
Posts: 39
Joined: Wed Jun 05, 2013 2:15 pm

Re: Unnecessary Scroll when identifying elements.

Post by brgibb » Wed May 07, 2014 9:04 am

Yip - I tried that but no difference in the behavior. The scroll still occurs....

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

Re: Unnecessary Scroll when identifying elements.

Post by krstcs » Wed May 07, 2014 2:10 pm

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.
Shortcuts usually aren't...

brgibb
Posts: 39
Joined: Wed Jun 05, 2013 2:15 pm

Re: Unnecessary Scroll when identifying elements.

Post by brgibb » Wed May 07, 2014 4:19 pm

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.

:-/

mzperix
Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Unnecessary Scroll when identifying elements.

Post by mzperix » Wed May 07, 2014 4:25 pm

Did you try to turn off the ensure visible for all elements in Ranorex Studio? It is found in General Settings.
Attachments
turn_off_ensure_visible.png
turn_off_ensure_visible.png (47.12 KiB) Viewed 1493 times

brgibb
Posts: 39
Joined: Wed Jun 05, 2013 2:15 pm

Re: Unnecessary Scroll when identifying elements.

Post by brgibb » Fri May 09, 2014 9:21 am

I'm not using the studio - simply coding C# using the Ranorex libraries.

Anyone from Ranorex know a workaround to this?

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

Re: Unnecessary Scroll when identifying elements.

Post by Support Team » Mon May 12, 2014 3:23 pm

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
.
Image

brgibb
Posts: 39
Joined: Wed Jun 05, 2013 2:15 pm

Re: Unnecessary Scroll when identifying elements.

Post by brgibb » Tue May 13, 2014 9:17 am

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.

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

Re: Unnecessary Scroll when identifying elements.

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

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
.
Image

brgibb
Posts: 39
Joined: Wed Jun 05, 2013 2:15 pm

Re: Unnecessary Scroll when identifying elements.

Post by brgibb » Wed May 21, 2014 11:14 am

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......?

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

Re: Unnecessary Scroll when identifying elements.

Post by Support Team » Thu May 22, 2014 4:24 pm

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
.
Image