Forum Discussion

colsson's avatar
colsson
Occasional Contributor
7 years ago
Solved

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

 

 

Kind Regards

colsson

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

18 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    What kind of object is it?  Because the last article you posted gave a suggestion for menu items... if that's what you're dealing with, could you verify?

    As for what property to wait for... I'd actually wait for the object itself before you act on it... something like "WaitAliasChild" or "WaitChild".  Reference those help topics and see if they give you any insight.

    • colsson's avatar
      colsson
      Occasional Contributor

      Thank you Mr. Martin!

       

       

      No it is not a menu item. I posted that article link because that was the only article I could find on that subject.

       

      • Does both WaitAliasChild and WaitChild require the parent object or could they be used using just the object?
      • What would you do if you could not access the parent object?

       

       

      Kind Regards

      colsson

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        If you cannot access the parent object, you have bigger problems...  that means that you have object identification problems further up the hierarchy.

         

        It might help to know a bit more what automation code you are executing that is getting that error... we could probably find a way to get you what you need.