EnsureVisible() always returns false

Bug reports.
roneil
Posts: 19
Joined: Wed Sep 07, 2011 3:59 pm

EnsureVisible() always returns false

Post by roneil » Tue May 15, 2012 10:31 pm

Howdy,

Our automated test team uses common methods to interact with different types of WinForms controls in a standardizwed manner. Many of these methods include a call to EnsureVisible() to ensure access to the related GUI object before the methods take any actions with them (click, enter text, scroll, etc.).

These methods examine the EnsureVisible method's return value and record a warning when it returns False to make script debugging easier:

Code: Select all

if (!adapter.EnsureVisible())
{
    Report.Warning("Could not make adapter (" + adapter + ") visible!\r\nWill try to process anyway.");
}
Unfortunately, we have found that, in every case, the EnsureVisible method ALWAYS returns False, meaning that we get false warnings of failures. The API documentation for the return value says:
True if the operation has suceeded.
We cannot tell if the method is always failing (and our controls just happen to always be visible) or if the documentation is incomplete (e.g, the method also returns False if the control is already visible and the method doesn't perform any actions).

We still have occasional cases where a script cannot interact with a control (like clicking a button) one time out of X. We need the ability to determine when and why this occurs. We thought EnsureVisible would give us this capability.

Is there a bug with the return value of EnsureVisible? Is the documentation complete as to when and why the methods will return True or False?

Our script development is taking place on Windows 7 x64 systems using Ranorex 3.1.3 and VS 2010. Our scripts interact with a WinForms application built using C#.NET in VS 2010. Both scripts and applications are compiled as AnyCPU and .NET 3.5(.1).

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

Re: EnsureVisible() always returns false

Post by Support Team » Wed May 16, 2012 5:06 pm

Hi,
roneil wrote:Unfortunately, we have found that, in every case, the EnsureVisible method ALWAYS returns False, meaning that we get false warnings of failures.
The API documentation for the return value says:
True if the operation has succeeded.
Basically some technologies does not support the "EnsureVisible" functionality which means, that allays false will be returned. Therefore there is no way to check whether they are visible or not.

A workaround to overcome this issue is to try to call the Focus or the Select method on regarding elements, which of course does not do the same as EnsureVisible.

Regards,
Tobias
Ranorex Team