03-13-2014, 06:09 PM
I am trying to pass objects to functions and check if that particular object exists or not and depending on that functions would return true/false.
But the eval used here does not seems to work doing its job.
Object that i pass is of image type and it still goes inside if conditions after eval... any help plz
But the eval used here does not seems to work doing its job.
Object that i pass is of image type and it still goes inside if conditions after eval... any help plz
Code:
'In script file
'========
if WebApp_Exists( objHndM.Page("H&M IPS - Interior Production").Frame("navFrame"),"ButtonNew") then
objHndM.Page("H&M IPS - Interior Production").Frame("navFrame").Image("ButtonNew").Click
logPassFail err,"ButtonNew"
end if
'In the library file
'=============
Function WebApp_Exists(byref objEst,byval objName)
msgbox objEst.Image("ButtonNew").exist
Dim CTRL_TYPES
CTRL_TYPES = Array( "WebEdit" _
, "WebCheckBox" _
, "Image" _
, "WebButton" _
, "WinButton" _
, "WebElement" _
, "Link" _
, "WebRadioButton" _
, "WebRadioGroup" _
, "WebList" _
, "WebTable" _
)
Dim iCount
checkExistStatus = False
for iCount = 0 to Ubound( CTRL_TYPES)
Dim ctrlType
ctrlType = CTRL_TYPES(iCount)
On Error Resume Next
Err.Clear
'ctrlType = "WebEdit"
' Set ExistStatus = eval("objEst."& ctrlType&"(objName)")
Set ExistStatus = eval("objEst."&ctrlType&"(objName)")
If ExistStatus.Exist(0) Then
checkExistStatus = True
Exit Function
else
checkExistStatus = False
End If
Next
End Function