Page 1 of 1

How to know when a window is completely loaded?

Posted: Mon Sep 07, 2009 11:00 am
by cancerion
Hi,

I want to know how can identified that a form has been loaded completely or it is still loading state?

For example, if we launch MS Outlook it took sometimes to load form. How can we know that form has loaded or not?

Thanks,
Sachin

Re: How to know when a window is completely loaded?

Posted: Mon Sep 07, 2009 1:16 pm
by Support Team
Hi cancerion,
try to access the form element. If the form window isn`t loaded you get an ElementNotFound exception.
You can run the check in a loop and wait an amount of time until the next recheck.

e.g.
sample code
Ranorex.Form form = null;
while(true)
{
  try
  {
    form = repo.FormAdobe_Reader.FormAdobe_Reader;
    break;
  }
  catch
  {
    System.Threading.Thread.Sleep(4000);
    continue;
  }
}
An other way to wait for the application to start is to set the element Search Timeout of your first element you want to access.

Web Documents:
In web documents you have the ability to check the State property.
The different states are: (invalid, loading, loaded, interactive, complete)

Best regards,
Christian
Ranorex Support Team