我已将以下函数与测试相关联,以便在行文本与预期值匹配时在java表中选择行:
Public Function GetRowWithCellText(ByRef oJTable, sColName, sText)
bChkText=FALSE
iRowCount=oJTable.GetROProperty("rows")
For iCounter=0 to iRowCount-1
sGetCellText=oJTable.GetCellData(iCounter, sColName)
If instr(sText, sGetCellText)>0 Then
bChkText=TRUE
GetRowWithCellText=iCounter
End If
Next
ReportingFunction bChkText, "Row with desired text"
End Function
RegisterUserFunc "JavaTable", "GetRowWithCellText", "GetRowWithCellText", TRUE
该函数已经很好地注册,我把它放在java表的可用函数列表中 . 但是在尝试将函数应用到我的应用程序中的JavaTable时:
JTable.GetRowWithCellText msg.users.list.table.header.user , LOGIN
我收到以下错误:
Object required: 'msg'
Line (122): "JTable.GetRowWithCellText msg.users.list.table.header.user , LOGIN".
请注意,UFT没有识别我的表的cols,所以我手动插入了它的值
2 回答
从'Object required'错误中可以看出,未定义'msg'的值 .
msg.users.list.table.header.user
的第一部分引用名为'msg'的对象 . 如果该对象不存在或尚未初始化,则可能会出现该错误 .您可以破坏您的陈述以确认错误的位置 . 改变这个陈述
对这些陈述
当您重新执行时,如果
msg
出现问题,您应该在第二行收到错误;否则,如果您的功能确实存在问题,您将在第三行收到错误 .我已经使用列索引而不是列名称,它工作,我想有特殊字符的问题 .
谢谢