Regarding App.WaitWhileBusy();

Oct 18, 2010 at 11:50 AM

Hi all,

  I am launching an application using app.launch("path") , And then I need to do some operation and close the application. I used app.WaitWhileBusy() So it could wait until the application is loaded completely. But it does not wait until it loads and starts to perform actions defined. How could I do to wait until the application completely loaded?

 

 

Thanks in advance

Oct 18, 2010 at 12:12 PM
Edited Oct 18, 2010 at 12:14 PM

Please go through - http://white.codeplex.com/wikipage?title=Wait%20Handling&referringTitle=Home

and http://white.codeplex.com/Thread/View.aspx?ThreadId=215847

You will know that this WaitWhileBusy() is not the best method to work with for wait handling. 

 

Oct 19, 2010 at 7:18 AM

Sorry Rohit that didn't work for me. Could you put some more light by describing it? My application is a little heavy and opens a little late after executing the launch. So I should check for some condition to make sure application is loaded and visible to continue.

 

Thanks in advance.

Oct 19, 2010 at 8:54 AM

Hi

Have you looked for "Custom wait hook" on the first side Rohith linked in his answer?

What is the condition you will wait for?

Maybe some more details what the workflow is and which elements are you are waiting for, would be helpfull. (Wait for window appears, or element is enabled, .... there might be many conditions we can think about :) )

 

Throndorin

Oct 19, 2010 at 8:58 AM

Hi Throndrin,

  I have looked for "Custom wait hook" but I'm not able to understand it so I'd implement it. Well I have defined my application as App

  I'm lanuching the application , And when the application is launched it takes time to be visible. So I want to see if the application is visible so I can return the Application object to other class to perform operations. could you give one exapmle code for Custom wait hook?

 

Thanks in advance.

Oct 19, 2010 at 9:17 AM

Hi

I use a self defined waiter, and we don't change it to the new structure, so I can't explain how to use it, maybe other can describe this better.

We use class Timer to wait for special conditions.

 

Maybe a fast solution for you:

 

 

Application app = Application.launch("path"); List<Window> windows = app.GetWindows(); int count = 100;
bool found = false;

while(count !=0 && !found)
{
  if(windows.Exist(p=>p.Title == "title" && p.Visible))
  {
    found = true;             
  }
  else
  {
    Thread.Sleep (100);
    count--;
    windows = app.GetWindows();
  }
}

Window window = app.GetWindow("title");

 

Throndorin