How does EnsureVisible really work?

Class library usage, coding and language questions.
User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

How does EnsureVisible really work?

Post by Aracknid » Mon Sep 17, 2012 4:14 pm

I've got a control that is scrolled off screen. When I look at the info in the Spy tool. It says the screen location is "451, -2791". Yes, that's minus. But right under is says "Visible = True". How is that possible?

When I run my script and call my lower function to act upon this control, in the function I say "MyControl.EnsureVisible" which I would expect to scroll it into view, but that doesn't happen. I assume because it is "visible" even though it is not.

What's going on under the covers?

Aracknid

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: How does EnsureVisible really work?

Post by Ciege » Mon Sep 17, 2012 11:52 pm

It's possible you AUT is the one who is reporting the element as visible.

Also, the negative number is due to the X,Y coordinates on the element. So the negative number is the distance down the negative side of the Y axis. So if your AUT does indeed report visible incorrectly you can check the X,Y coordinates of your elements and scroll them into view yourself...
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: How does EnsureVisible really work?

Post by Aracknid » Tue Sep 18, 2012 2:26 pm

So does the Ranorex function called "EnsureVisible" just check the controls "Visible" property, and if that property is "True", it does nothing? To be honest, I thought it was doing more than just that. I've never had a problem with it until recently, so I figured it must be the way the HTML elements are laid out in my AUT. This particular place is quite complex with many IFrames in Divs in Iframes in Divs.... Part of the Iframe is visible, even though the control is not, so I thought maybe this was causing the confusion.

Alternatively, I would think it could be smarter and detect that negative coordinates (or coordinates that are outside of the screen resolution) imply the item is not visible.

Aracknid

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: How does EnsureVisible really work?

Post by Ciege » Tue Sep 18, 2012 4:46 pm

I'm afraid I can't answer your question about if EnsureVisible just checks the Visible property... Will need someone from support to answer that...
Quite honestly, I've seen several issues with EnsureVisible in the past with different tests I've run. Enough so that my framework does most of the scrolling into view for me.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

User avatar
Aracknid
Posts: 342
Joined: Tue Aug 10, 2010 3:23 pm
Location: Toronto, Ontario, Canada

Re: How does EnsureVisible really work?

Post by Aracknid » Tue Sep 18, 2012 6:06 pm

Yeah, I have problems with EnsureVisible too and I've also written lots of code to manually scroll. Guess I'll have to do the same with this specific troublesome area of my AUT.

Hmm.. maybe they should rename it to "AttemptVisible"...hahaha... :lol:

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

Re: How does EnsureVisible really work?

Post by Support Team » Wed Sep 19, 2012 3:41 pm

Hello,

The functionality depends very much on the technology, which is used. We not only check the 'Visible' property of the control. Ranorex tries to move forms to visible region of desktop by, e.g. scrolling.

Which technology is used for you controls? Could you send us a Ranorex Snapshot file from the control please.
Thank you!

Regards,
Bernhard
Ranorex Support Team
.
Image