Forum Discussion

siddhu's avatar
siddhu
Contributor
14 years ago

How to make TC to wait till an un known window open

Hi

   After clicking a button, there may come any one of below windows



Sys.Process("CDS").VBObject("frmStartup")

Sys.Process("CDS").VBObject("frmOpenOrDelete")



I dont know which window will come.But any one of these two will come depending on the situation.

I want to wait TestComplete to wait till any one of these window opens.

It takes some time to open the window.It is a windows application.It is not a web application



How to do this


5 Replies

  • Try using while (!Sys.Process("CDS").VBObject("frmStartup").Exists || !Sys.Process("CDS").VBObject("frmOpenOrDelete").exists) off course with some timeout. So your function may look like



    var timeout = 0;

    While (timeout < 100)

    {

         if ( !Sys.Process("CDS").VBObject("frmStartup").Exists || !Sys.Process("CDS").VBObject("frmOpenOrDelete").exists)

              break;

       timeout++

    }

    if ( timeout == 100 )

    {

          Log.Error ("No window exists");

    }
  • Please read

    if ( Sys.Process("CDS").VBObject("frmStartup").Exists || Sys.Process("CDS").VBObject("frmOpenOrDelete").exists)

              break;



    in the above comment
  • Hi Harshad

            Thanks For immediate Response

            

            Can we do it using Wait Object?
  • I could not understand what do you mean by Wait object. But every control has wait property that can be accessed exactly as I mentioned in the code.



    Regards,

    Harshad