Forum Discussion

StevenN's avatar
StevenN
Contributor
5 years ago

Error: Object not a collection

When using the FindAll method I am getting the runtime error - Object not a collection. This only occurs on certain Windows 10 machines and only when using specific scripting languages.

 

 

Out of the four machines I've tried it on, two will get the error when using C++Script, C#Script, JScript or VBScript. If using Python or JavaScript it will work. On the other two machines FindAll works correctly for all languages.

 

This is done using a new project and using the FindAll example from the help file. Does anyone have an idea what could be causing this?

 

All PC's are running:
TestComplete 12.1
Windows 10 Pro, Version 1903, Build 18362.592

  • Marsha_R It only works when stepping through the code if you switch to the locals tab and expand the actual object that is causing the error. If you don't expand it, or are viewing the call stack, watch list or breakpoint tab it will still show the error. I know all the ways to get around any timing issues, I've tried them all and unfortunetely nothing works. 

     

    I just need to put this down to the fact I'm using an older version of TestCompete and it's not going to work forever. Some Windows/third party update is bound to cause issues sooner or later, might be time to finally upgrade. 

     

     

  • Your TestComplete version is a little behind.  Can you try loading the latest version on one of the machines where it doesn't work and see if that fixes it?  It may already be patched.  

     

    Be careful and use a separate copy of your project when you do this.  Tests that are converted to a higher version of TC are not backwards compatible, so you don't want to lose your 12.1 copy.

    • StevenN's avatar
      StevenN
      Contributor

      Thanks for the suggestion, unfortunately our maintenance agreement has expired so 12.1 is the latest version I have access to.

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        It would be helpful to see the code where the error is occurring.  

         

        As a note, for FindAll, it returns in a safe array format which is not compatible with the JScript engine (which is what the C++ and C# script translators use).  See https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/findall-method.html#result-value

         

        Why it works 100% on two machines and not on the other two I'm not sure. But, generally speaking, you need to make sure you are using the proper type of array when using the result.

         

        In any case, please post a copy/paste of code that generates the error, indicating the line on which the error occurs, and we can perhaps help you further.