Forum Discussion

colsson's avatar
colsson
Occasional Contributor
7 years ago

Property Wait to avoid Window destroyed error on Activate

Which property and property value should waited for before calling Activate on an object to avoid the error: "The window was destroyed during method execution".   Activate Function: https://suppor...
  • tristaanogre's avatar
    tristaanogre
    7 years ago

    OK, I'm not sure I'd do that code...  

     

    So... why use "WaitChild" over "FindChild"?  Wait allows you to customize the wait time for TestComplete to wait for the object to be present.  Now, just came to memory, you CAN use FindChildEx.  This combines the search functionality of FindChild with the Wait feature of WaitChild.  

     

    If you use FindChildEx, make sure that you set the "refresh" property to "true".  That might help with the problem that you're originally reporting.  Basically, what's happening is that you're finding the object but after the object is found, it's destroyed and recreated... changing the in-memory handle of the object hence why it says it is destroyed before you are able to act on it.

     

    So... there is something that's happening between when you run your application and when you try to find that child object that is causing that object to be destroyed and recreated.  If I was in your shoes, what I'd do is start doing some investigation around that startup process of your application to see if there is some other property or process or something that will give you an indication that the application is ready for interaction before you go searching for the child object.