Page 1 of 1

Waiting for a form to be visible

Posted: Thu Jun 18, 2009 4:07 pm
by slither
In the application we are testing, sometimes it takes a little while for a form to be visible.

Lets say I click the MenuBar to load FormA. I then do a FindSingle<Ranorex.Form>("myRxPath"); to find the form. It does find the form almost right away (i'm guessing it's in memory, but not visible yet).

The problem here is if I want to click buttons on the form, currently it will perform the click() actions even if the form is not visible.

I tried using something like:

form.EnsureVisible();
form.button.EnsureVisible();
form.button.click();

but the same thing happens (looks like .EnsureVisible() is not actually checking Element.Visible to see if it's true)

Now I have somewhat of a workaround for this, which works good (obviously would need to add some limits to the time we are waiting...):

while(!form.Visible)
{
Ranorex.Core.Delay.Milliseconds(100);
}
form.button.click();


Is there any functionality for this built into Ranorex? I've seen "RxElementIgnoreInvisible(TRUE);" mentioned in the forum (old post from 2007), but can't find it in the documentation.

Re: Waiting for a form to be visible

Posted: Thu Jun 18, 2009 4:13 pm
by Ciege
What you do with the While loop is exactly what I do. However, I would suggest creating your own method that its job is to find and wait for a window to appear and be visible. That way you still only have to make a single call when you are waiting for a window to appear. Similarly you can create another method called WaitForWindowToClose to wait for a window to go away after submitting it or closing it in some form or fashion.

The EnsureVisible has been problematic for me at times on different controls so I tend to stay away from it or at least supplement it with my own check of form.visible or element.visible.

Re: Waiting for a form to be visible

Posted: Mon Jun 22, 2009 2:00 pm
by Support Team
Currently, there is no functionality to wait for an element to become visible. The EnsureVisible method just tries to make an element visible and returns whether that was successful. So, as Ciege recommended, you could write your own helper method that waits until an element is visible.

The RxElementIgnoreInvisible is a setting that is specific to Ranorex 1.X versions.

Regards,
Alex
Ranorex Support Team