Forum Discussion

miguelssantos's avatar
miguelssantos
New Contributor
10 months ago

How to resolve this error "Window was destroyed during method execution" using ObjectSpy?

Hello, we are implementing automated tests in my company and I am analyzing how TestComplete behaves when reading our system. We are using TC 12.20. When reading a system window that I use with ObjectSpy, TestComplete closes the system and displays the following errors:

Error: Cannot obtain the rectangle of the window with handle 528464

Error: Error
The window was destroyed during method execution.
The window with the handle 0x00081050 does not exist.
Most likely, this error occurred because the tested object (window or control) or its parent object was deleted or recreated during the method call or before it. For instance, the window could be destroyed or recreated after you stored the object reference to a variable and before you called the object method through this variable.
If the object is recreated, then to avoid the error, check the object's Exists property before calling the method, and if the object does not exist, obtain a reference to the new object.

The system is in Delphi 10.2. This problem does not happen in all windows, just in some, could you tell me what is causing this conflict???

Thanks

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Does the object Sys.Process("MegaHome").VLCObject("FromAgente") actually exist? If you look at the Object Browser, you might not be able to see the object.

    It could be a dynamically created object, which then gets deleted. 

    • miguelssantos's avatar
      miguelssantos
      New Contributor

      Yes, the error only occurs when trying to read the entire window, when reading just one component of it this reading is done successfully.

  • Yes, the error only occurs when trying to read the entire window, when reading just one component of it this reading is done successfully.