Ask a Question

Error: Object not a collection

SOLVED
StevenN
Contributor

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.

 

ObjectNotACollection.PNG

 

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

21 REPLIES 21

I've tried adding delays and using WaitWindow but I still get the error. I even get the error in the debugger when stepping through if I stay in the Call Stack tab, I have to actually switch to the Locals tab and view the objects in order to get by the errors.   

 

 

tristaanogre
Esteemed Contributor

On the machines experiencing the problem.... are you running TestComplete as a local admin?  If not.... give that a try.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
sonya_m
SmartBear Alumni (Retired)

Alex, Marsha, Robert, thank you for helping!

 

Hi @StevenN , did you have any luck with running TestComplete as a local admin like tristaanogre suggests? Or, mayhaps, you found any other way to solve this? Thanks.


Sonya Mihaljova
Community and Education Specialist

Still get the issue when running it as an admin, doesn't look like there is a proper solution, only workarounds. 

Hi,

 

Just a wild guess:

> w = p["Window"]("#32770", "Font");

The case might be related to populating dialog controls with data. It looks that when the dialog is opened, it populates itself with the list of installed fonts, their styles and pitches and renders the Font list with font samples. These actions take time and it might be that while the Font window already exists and can be referenced in code, it is still not initialized completely and thus the search for the Edit controls fails.

 

Somewhere in time, in order to resolve this and related problems, I did a loop in my test code for the required control and waited until the number of items in the list box stop to increase.

(E.g. Sys.Process("notepad").Window("#32770", "Font", 1).Window("ComboBox", "", 1).Window("ComboLBox", "", 1).wItemCount)

 

You may consider how suitable the above sounds for your case.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
TanyaYatskovska
SmartBear Alumni (Retired)

Hi @StevenN,

 

If none of the suggestions help, I recommend that you refer this question to the Support Team - they may need to investigate the issue in the test lab. You can reach out to them here:

https://support.smartbear.com/message/?prod=testcomplete

 

 

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager



Thanks for all the suggestions, have now contacted support and will post an update if they can find out what is causing the issue. 

@TanyaYatskovska Can you mark this as unresolved? Support won't look at it as I don't have a maintenance subscription. 

I agree with @tristaanogre 

 

If you can step through the code and it works, but running it causes the object to not be recognized properly, it's a timing issue.  There are several ways you can adjust the timing of the test, both within the code and in the settings, so let us know if you want help with that.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
sonya_m
SmartBear Alumni (Retired)

@StevenN I've marked this unsolved. Please let the Community know if you would like the Community to help you with adjusting timing.


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: