Forum Discussion

luke_jones's avatar
luke_jones
Occasional Contributor
12 years ago

QuerySelector and "The window was destroyed during the execution method"

Hello, 



In my web test project I use the QuerySelector method to select objects on my page. For example...



var base = Alias.browser.myPage; 

base.QuerySelector("#myButton").Click(); 



This has always worked fine but when I tried to run my test project today I received the error "The Window was destroyed during the method execution" on every step that calls page objects in this way. 



Following the advice in the error message I put a CheckProperty on the exists property of the button before calling it and this passes so I am not sure why the clicks themselves are failing. 

7 Replies


  • Hi Luke,


     


    When the Exists property is called, it slows down the test execution for a while - this gives TestComplete some time to recognize objects on a page properly. Perhaps, the browser was updated, and this caused the behavior.


     

  • luke_jones's avatar
    luke_jones
    Occasional Contributor
    I'm don't know why the tests have suddenly stopped working though. As you can see from the below my tests consists of three steps on which the third fails with the 'destroyed' error message.




      Browsers.Item(btChrome).Navigate(diaryAddress);


      var base = Aliases.browser.clinicsDiary;


      base.QuerySelector("#locationSelector button").Click();



    The page that is loaded in the first step is a static page so shouldn't be changed before the click action is run. 



    Do you have any suggestions? 

  • hlalumiere's avatar
    hlalumiere
    Regular Contributor

    Try something like this instead:



      Browsers.Item(btChrome).Navigate(diaryAddress);


      var base = Aliases.browser.clinicsDiary;

      var obj = base.QuerySelector("#locationSelector button");

      obj.Click();



    Does it crash on line 3 or 4?
  • luke_jones's avatar
    luke_jones
    Occasional Contributor
    I got a colleague of mine to run the same project and it worked fine for him so I uninstalled the Chrome plugin, restarted my machine and then re-installed the plugin and it all started working rather annoyingly :( 
  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 1 rankChampion Level 1
    Hi Luke,



    I got the same problem (with TC 9.31) after Chrome updated itself to more recent v31 than I had.

    Now it updated itself to v32 and I even don't want to try if it works or not... :S

    What I need to spend the time on now is to go through all recommendations as for how to stop Chrome from updating itself, put all Google updaters I will be able to find on my machine into firewall's block list and, most probably, delete them at all from the disk.

    I really hate when software developers think that they know better what I need and do this silently without any warning.
  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 1 rankChampion Level 1
    For me the only useful service from Google is its search engine, so I prefer more radical approach and not waist resources of my box by running something that does nothing: http://smartbear.com/forums/f81/t85755/cannot-find-the-window-with-handle/#85802

    ;))



    If / when Google decides to check for existence of the Update folder and start re-creating it, I will consider creation of backup local admin user and revoke all but Read and Execute permissions for the Google folder for my account and will explicitly deny all permissions for other accounts. :P