我已将以下函数与测试相关联,以便在行文本与预期值匹配时在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,所以我手动插入了它的值
答案 0 :(得分:1)
它出现在'对象所需的'错误表示' msg'的值没有定义。 msg.users.list.table.header.user
的第一部分是指一个名为' msg'的对象。如果该对象不存在或尚未初始化,则可能会出现该错误。
您可以破坏您的陈述以确认错误的位置。更改此声明
JTable.GetRowWithCellText msg.users.list.table.header.user , LOGIN
致这些陈述
Dim user
Set user = msg.users.list.table.header.user
JTable.GetRowWithCellText user, LOGIN
当您重新执行时,如果msg
出现问题,您应该在第二行收到错误;否则如果你的功能确实存在问题,你将在第三行收到错误。
答案 1 :(得分:0)
我使用了列索引而不是列名,但是它运行起来了,我想特殊字符存在问题。
由于