cancel
Showing results for 
Search instead for 
Did you mean: 

Microsoft JScrip runtime error "Object not a collection"

SOLVED
Occasional Contributor

Microsoft JScrip runtime error "Object not a collection"

I use test script to test my Desktop application written in Winform c#.
I started to get Microsoft JScrip runtime error "Object not a collection" when try to find an object using TestComplete Find method.

The test scrips have not been changed for a while and suddenly this error started on so many different objects.

The only thing change on my PC I can think of is that I have .Net 4.7.1 installed, previously was 4.6.2

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: Microsoft JScrip runtime error "Object not a collection"

Hi @SZ_1,

 

Will it help if you add some delay before calling Find?

delay(500);
---------
Tanya Gorbunova
SmartBear Community Manager

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!

View solution in original post

3 REPLIES 3
Highlighted
Occasional Contributor

Re: Microsoft JScrip runtime error "Object not a collection"

I have attached the image of the error.

I should mention that if a put a break point at the Find statement and step over it, there would be no runtime error mentioned above. The error occurred if a ran the scripts without break point at the Find statement.

Highlighted
Community Manager

Re: Microsoft JScrip runtime error "Object not a collection"

Hi @SZ_1,

 

Will it help if you add some delay before calling Find?

delay(500);
---------
Tanya Gorbunova
SmartBear Community Manager

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!

View solution in original post

Highlighted
New Contributor

Re: Microsoft JScrip runtime error "Object not a collection"

@TanyaGorbunova , I met the same issue.

 

Below is the script, it's written in VB

 

Dim LibraryCollection
set LibraryCollection=Aliases.Inventor.AInventor.Pane_AssetBrowser.tvw_Asset.WPFObject("TreeViewItem", "", 3)
Call Aliases.Inventor.AInventor.Pane_AssetBrowser.tvw_Asset.ExpandItem("|[2]") 'expand project library node
Dim TargetAsset
set TargetAsset=LibraryCollection.WPFObject("TreeViewItem", "", 1).WPFObject("TreeNodeBorder")
Call TargetAsset.ClickR(55,5)
TargetAsset.PopupMenu.Click("[4]") 'right click the target asset and edit 

delay(20000)
Common_Routines_Factory.RefreshNamemapping
While Aliases.Inventor.AInventor.Pane_ModelBrowser.zcrumbCtrl_ModelBrowser.ChildCount(4) <> "Ready"
  aqUtils.Delay 2000
  statusBarObj.Refresh
Wend
call Aliases.Inventor.AInventor.Pane_ModelBrowser.Click(70,35) 'switch to Asset builder sub page

 

and after seeing your solotion provided, I tried adding "delay(20000)", and refreshnamemapping "Common_Routines_Factory.RefreshNamemapping", but they don't work for me.

 

and for this mapped object  Aliases.Inventor.AInventor.Pane_ModelBrowser.zcrumbCtrl_ModelBrowser do has the property childcount, you could check it from the screenshot.