Forum Discussion

Shehnaz's avatar
Occasional Contributor
5 years ago

Getting "The window was destroyed during method execution" error in TestExecute on windows server

When trying to run TC script on Windows server 2016 getting error - The window was destroyed during method execution" after the url opens in chrome browser.

Script runs fine in my desktop but in server it returns this error.

Can anyone help?

  • sonya_m's avatar
    5 years ago

    Hi Nikolayev , maybe you could consider updating first? I see that you are using not the latest version.

    If this doesn't help, contacting support would be the best next step.

16 Replies

  • tristaanogre's avatar
    Esteemed Contributor

    That error, in my experience, is usually something having to do with an un-seen page refresh and, therefore, a timing issue... TestComplete has identified the object and so the action (click, keys, etc) is attempted but, in that split second, the object is destroyed and recreated in memory (page refresh, etc) so that the previous memory handle is no longer valid and so the click, keys, etc., generates the error.


    You will need to examine the code around that particular situation and see if you can make it "smarter" to determine if the page has been properly loaded, all client-side scripts have completed, etc., before proceeding on to the UI action.

    The reason why it works on yours and not on the other machine, as mentioned, is most likely timing.  The automation is running at "full speed" but on that server box there may be other factors that are slowing down the application execution so that it can't "keep up" with the automation speed.

    • Shehnaz's avatar
      Occasional Contributor


      I understood the reason why I am getting the error but how should I resolve this?

      I tried adding aqUtils.Delay(5000, "Delaying Test Run"); to delay execution and wait for page load but still getting same error. 

      Any other solution recommended by you?

      • BenoitB's avatar
        Community Hero

        Does the error just happens after .navigate or .toUrl call ? A sample of your call please and the log concerned

        Does the error is systematic on WS2016 ?

        Does the error happens on other browser on WS2016 ?