cancel
Showing results for 
Search instead for 
Did you mean: 

Project.Variables.TblColumnID.Item(0, Count) failed

Highlighted
Frequent Visitor

Project.Variables.TblColumnID.Item(0, Count) failed

 

 

Script is failing becuase it trying to call the "name" method or property of an object that does not exist.

 

image.png

 

This is what stored into ColumnID script 

Sub StoreColumnIDs(GridObject)
'Store all ColumnIDs to TblColumnID
Log.AppendFolder("StoreColumnIDs: " & GridObject.name)
Call Log.Picture(sys.Desktop,"Screenshot")
For Count = 0 To (GridObject.Cols.Count - 1 )Step 1
GridObject.Row = 0
GridObject.Col = Count
Project.Variables.TblColumnID.Item(0, Count) = Count

Set Project.Variables.TblColumnID.Item(1, Count)= GridObject.Clip
Log.Message(Project.Variables.TblColumnID.Item(0, Count) & " - '" & Project.Variables.TblColumnID.Item(1, Count)) & "'"

Next
log.PopLogFolder
End Sub

Sub GetColumnID(ColumnName)
'Find ColumnID from TblColumnID
'Set Project.Variables.TempInt2 = ColumnID
' Set regEx = New RegExp
' regEx.Pattern = ColumnName
' regEx.Global = True
' If regEx.test(Project.Variables.TblColumnID.Item(1, Count)) = True Then
For Count = 0 to 299 Step 1

If Project.Variables.TblColumnID.Item(1, Count) = ColumnName Then

Project.Variables.TempInt2 = Project.Variables.TblColumnID.Item(0,Count)
Exit For
End If
Next
Log.Message("'" & ColumnName & "' - " & Project.Variables.TempInt2)

End Sub

Sub StoreColumnIDs_AEInbox(ParentObject) 'sub routine works for AEInbox Tables and Eleven Tables (e.g. Eleven Edit Station Change)
Log.AppendFolder("StoreColumnIDs: " & ParentObject.name)
Call Log.Picture(sys.Desktop,"Screenshot")
For Count = 0 to ParentObject.ColumnCount(0)-1 Step 1
Project.Variables.TblColumnID.Item(0, Count) = Count
Project.Variables.TblColumnID.Item(1, Count) = ParentObject.Cell(0,Count).ContentText
Log.Message(Project.Variables.TblColumnID.Item(0, Count) & " - '" & Project.Variables.TblColumnID.Item(1, Count)) & "'"
Next
log.PopLogFolder
End Sub

Sub StoreColumnIDs_Eleven(ColumnHeaderObject) 'Sub routine works with slickgrids - AEinbox Enter Station Change and Eleven slick grid
'USE THIS ColumnHeaderObject Aliases.browser.pageEleven2.panelOrderbar.panelOrderGridSlickgridUiWidgetS.panelSlickPaneSlickPaneHeaderSli.panelUiStateDefaultSlickHeaderSl.Panel(0)

'Use this columnheader object for AEinbox enter station change Aliases.Browser.Find("Name", "*Panel*slickGrid*", 10).Panel(1).panel(0).panel(0)
Call Log.Picture(sys.Desktop,"Screenshot")
Log.AppendFolder("StoreColumnIDs: " & ColumnHeaderObject.name)
For Count = 0 to ColumnHeaderObject.childNodes.length - 1
Project.Variables.TblColumnID.Item(0, Count) = Count
Project.Variables.TblColumnID.Item(1, Count) = ColumnHeaderObject.childNodes.item(Count).textContent
Log.Message(Project.Variables.TblColumnID.Item(0, Count) & " - '" & Project.Variables.TblColumnID.Item(1, Count)) & "'"
Next
log.PopLogFolder
End Sub

Sub ClickCell(GridObject, rowIndex, colIndex, clickType)

x = GridObject.Getcellrectdisplay(rowIndex, colIndex).X+5
y = GridObject.Getcellrectdisplay(rowIndex, colIndex).Y+(GridObject.Getcellrectdisplay(rowIndex, colIndex).height)/2

If clickType = "Click" then
GridObject.Click x,y
elseif clickType = "ClickR" then
GridObject.ClickR x,y
elseif clickType = "ClickM" then
GridObject.ClickM x,y
elseif clickType = "DblClick" then
GridObject.DblClick x,y
elseif clickType = "DblClickR" then
GridObject.DblClickR x,y
elseif clickType = "DblClickM" then
GridObject.DblClickM x,y
Else log.Warning ("No clickType selected. Use Click, ClickR, ClickM, DblClick, DblClickR, DblClickM")
End If

End Sub

 

 

 

 

 

Script is failing becuase it is not able to find prant object name 

Project.Variables.TblColumnID.Item(0, Count) = Count

 

Can someone please help me.

Thanks!

 

2 REPLIES 2
Community Hero

Re: Project.Variables.TblColumnID.Item(0, Count) failed

This is very often a timing issue. The test is running faster than the objects load.

 

You can play around with it by putting a Delay before the line that fails and see if that helps.  Once you've figured out about how long you need for this to work, use WaitChild or something similar instead of Delay.

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/page/wait-action-page...

Community Manager

Re: Project.Variables.TblColumnID.Item(0, Count) failed

Hi @tarana08,

 

Was the question resolved or do you still need any assistance?

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓