How to know when a window is completely loaded?

Ask general questions here.
cancerion
Posts: 30
Joined: Tue Jun 16, 2009 6:15 pm

How to know when a window is completely loaded?

Post by cancerion » Mon Sep 07, 2009 11:00 am

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

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

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

Post by Support Team » Mon Sep 07, 2009 1:16 pm

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
.
Image