Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Passing objects to Functions
#1
Not Solved
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

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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Passing Object to Function Mozza 2 1,875 08-02-2018, 03:22 AM
Last Post: Mozza
  Inserting variable values into Descriptive Programming Functions eske99 2 3,510 12-18-2015, 01:47 PM
Last Post: vinod123
  vb script to stop execution of functions if conditions fail visitjaga 1 7,380 12-05-2013, 12:26 AM
Last Post: ravi.gajul
  XML Read Functions Nish 2 4,754 11-26-2011, 11:57 PM
Last Post: Nish
  Functions invoke of others test Juan Carlos 3 3,408 09-20-2010, 07:11 PM
Last Post: lotos

Forum Jump:


Users browsing this thread: 1 Guest(s)