Search code examples
vbscriptqtphp-uft

Could no use registered function in UFT/QTP


I have associated the following function to a tests in order to select a row in a java table when a the row text matches an expected value :

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

The function is well registered and I got it in the list of available functions for a java table. However when trying to apply the function into a JavaTable in my application :

JTable.GetRowWithCellText msg.users.list.table.header.user , LOGIN

I get the following error :

 Object required: 'msg' 

 Line (122): "JTable.GetRowWithCellText msg.users.list.table.header.user , LOGIN". 

Please note that UFT is not recoginising cols of my table so I had inserted its value manually


Solution

  • I have used column index instead of column name and it worked , I guess there is an issue with special characters.

    Thanks