EnsureVisible() method doesn't ensure whole object visible

Class library usage, coding and language questions.
User avatar
Posts: 22
Joined: Tue May 19, 2009 2:01 pm
Location: York, UK

EnsureVisible() method doesn't ensure whole object visible

Post by daa » Fri Jun 11, 2010 2:34 pm

Version: Ranorex

I'm automating web application testing, and I have a generic "click on some tag by RxPath" method, that looks like this:

Code: Select all

        public static void ClickTag(string aRxPath)
            Ranorex.WebElement lTag = aRxPath;
The problem is that whatever's underneath EnsureVisible() seems to regard a web element as visible if any pixel is showing on the screen. This means that the click sometimes doesn't happen, if previous bits of code have left the screen such that the next thing to click has just a few pixels visible. Note that the Mouse.Click() method defaults to Location.Center, but changing the location wouldn't help anyway, since you could, by other screen moves, have any edge of the object [not] visible.

Is there an EnsureEntireObjectVisible() method, or a workaround for this please?
David Allsopp,
Test Automation Engineer, Mitrefinch Ltd.

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

Re: EnsureVisible() method doesn't ensure whole object visible

Post by Support Team » Mon Jun 14, 2010 5:48 pm

Youre right, thats definitely wrong behavior. It should make the element totally visible (if possible).
I was able to reproduce this in Internet Explorer, but not in Firefox.
A possible workaround would be to check if the element rectangle intersects the web document rectangle and then scrolling to some element on the top/bottom to make your target element completely invisible. Thats a bit ugly, though.
Or you try using the WebElement.PerformClick method to invoke a click on the element instead of a real click with the mouse.

We will provide a fix for this in the next maintenance release (V2.3.2)

Ranorex Team