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.
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:
Windows 10 Pro, Version 1903, Build 18362.592
Solved! Go to Solution.
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.
On the machines experiencing the problem.... are you running TestComplete as a local admin? If not.... give that a try.
[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
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.
Community and Education Specialist
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.
/Alex [Community Champion]
[Community Champions] 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 Champions]
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 Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
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:
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.
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.
@StevenN I've marked this unsolved. Please let the Community know if you would like the Community to help you with adjusting timing.
Community and Education Specialist