test1

'-------------------------------------------------------------------------------------------------
' Core Functions
' 1) f_Create_List_Dialog
' 2) f_OpenFileDialog
' 3) f_GetCurrentTime
' 4) f_AddNewFolder
' 5) f_SetupRunResultsI
' 6) f_SetupRunResultsII
' 7) f_CloseOpenBrowsers
' 8) f_InitializeArrays_MedClaim
' 9) f_InitializeArrays_DenClaim
' 10)f_InitializeArrays_MedEB
' 11)f_InitializeArrays_DenEB
' 12)f_InitializeArrays_PharmEB
' 13)f_InitializeArrays_PharmClaim
' 14)f_ClearArray
' 15)f_PrintLog
' 16)f_SavePrintLog
' 17)f_whichwindow
' 18)f_SelectListItem
' 19)f_SelectCalendarDate
' 20)f_ClmWhichwindow
' 21)f_ClearClmArray
' 22)f_InitializeArrays_MedCT
' 23)f_MedCTWhichwindow
' 24)f_DenEBWhichwindow
'   25) f_InitializeArrays_DenCT
'   26) f_DenCTWhichwindow
'   27)  f_DenClmWhichwindow
' 28) f_DenSelectCalendarDate
'-------------------------------------------------------------------------------------------------
'#############################################################################################
'#
'#  Dim Global arrays
'#  
'#  Description : This Statement declares global array for accessing from all Actions.
'#  
'#############################################################################################

 Dim arField(90) , arInp(4) , arPat(7), arBen(54), arClmSummary(1), arClmDtl(7), arExp(60, 100) ,arClmExp(90, 100, 45) , arClmAct(90, 100, 45), arAct(60, 100), arMedClAct(90,100), arInput(9), tpossiblewindow(10),arExpSumSect(6), arActSumSect(6), arExpDtlSect(6),arActDtlSect(6),  vFirstRow , tCurRow, tDebugMode, vWin , terror, arLFExp(100,10)
 Dim NumofMedBen,NumofMenBen,NumofVisBen, arLFFields
arLFFields = Array("StepResult","Action", "Fieldtype","Browser", "Page", "Frame", "Field", "Property", "IEValue", "FFValue")

'#############################################################################################
'#
'#  f_Create_List_Dialog
'#  
'#  Description : This function Creates a list Dialog box to capture the user input selection.
'#  
'#############################################################################################
  Function f_Create_List_Dialog(Title, message, List)
 On Error Resume Next       'Used Later to handle items not in our list
 msg = message        'This is the basic message
 
 for i = lbound(List) to ubound (List)
  newmess = msg & vbCrLf & cstr(i + 1) & " - " & List(i)  'loop through the Array and add
  msg = newmess      'Each item from it to the list
 next
 
 flag = 0        'Controls when we have a valid selection
 
 do while flag = 0
  Ret = InputBox(msg,Title,"1")     'prompt for a selection from the list
  Ret = CInt(Ret)      'Convert the selection to an Int
  f_Create_List_Dialog = List(Ret-1)    'Set the fuction to equal the correct array element
  flag = 1      'break out of the loop
 
  If f_Create_List_Dialog = "" Then    'If we selected an invalid array element(C_L_D will be Null)
   flag = 0       'reset the flag to 0 and loop round again for a vaild entry.
  end if
 Loop
  End Function

'#############################################################################################
'#
'#  f_OpenFileDialog(tpath,kDataTable)
'#  
'#  Description : This function Creates a File Select Dialog box to select the Datatable
'#        the datatable for Testcase Execution.
'# Parameters  : in  tpath      --> The path of the where datatables are stored.
'#        out kDataTable --> The path and name of the selected datatable
'#  
'#############################################################################################

  Function f_OpenFileDialog(tpath,kDataTable)
 'msgbox("i am in fopefiledialog function before tpath msgbox")
 'msgbox(tpath)
 Set ObjFSO = CreateObject("UserAccounts.CommonDialog") 
 ObjFSO.Filter="ExcelFiles|*.xls"
 ObjFSO.FilterIndex = 1

 ObjFSO.InitialDir = tpath

 InitFSO = ObjFSO.ShowOpen 
 If InitFSO = False Then
  msgbox  "Cannot proceed without selecting DataTable....Please Re-run the script!"
  End If
 KDataTable = ObjFSO.FileName
 'msgbox(KDataTable)
 
  end function

'#############################################################################################
'#
'#  f_GetCurrentDateTime(time)
'#  
'#  Description : This function returns Date and time in the following format
'#        MM MONYYYY_HH MM SS
'# Parameters  : Out time --> The present time in the above format.
'#  
'#############################################################################################
 
  Function f_GetCurrentDateTime(tDateTime) 
 Dim tTime, tDate, tMonth, tDay, tYear, tdate_ddmonyyyy
 

 tHour = Hour(Now)
 if tHour   tHour = "0"& tHour
 end if
 

 tMin = Minute(Now)
 if tMin   tMin = "0"& tMin
 end if
 'msgbox ("the Min is "& tMin)
 
 tSec = Second(Now)
 if tSec   tSec = "0"& tSec
 end if
 'msgbox ("the Sec is "& tSec)

 tTime = tHour &" " & tMin &" " & tSec
 'msgbox (tTime)
 

 tDate = Date
 'msgbox(tDate)
  
 tMonth  = MonthName(Month(CDate(tDate)), true)
 tDay = Day(Date())
 tYear= Year(Date())

 If tDay  tDay="0"& tDay
 End If

 tdate_ddmonyyyy = tDay & " " & tMonth & " " & tYear
 'msgbox (tdate_ddmonyyyy)
 
 tDateTime = tdate_ddmonyyyy & "_" & tTime 

  end Function

'#############################################################################################
'#
'#  f_AddNewFolder()
'#  The above code checks whether the specified folder exists before attempting to create it.
'#  If the folder exists, nothing is done, otherwise the folder is created.
'# If no name is specified for the folder, the folder will be created with the name "New Folder."
'#  
'#############################################################################################
  function f_AddNewFolder(path, folderName)
    Dim fso1, f, fc, nf
    Set fso1 = CreateObject("Scripting.FileSystemObject")
    Set f = fso1.GetFolder(path)
    Set fc = f.SubFolders
    If folderName "" Then
      If Not(fso1.FolderExists(path & folderName)) then
 Set nf = fc.Add(folderName)
      End If
    Else
    Set nf = fc.Add("New Folder")
    End If
  End function


'#############################################################################################
'#
'#  f_SetupRunResultsI()
'#  
'#  
'#
'# NOTE: 
'#     -> f_SetupRunResultsI is used in conjunction with 'f_SetupRunResultsII',
'#   which is run at the end of the script, to move the completed results
'#   table from local drive to its final destination
'#
'#  Description: 
'#   Step 1. Get directory path of the data table
'#   Step 2. Check whether TestRuns folders exists in this directory.  If not, create one.
'#   Step 3. copy table to C:Temp and then rename it by adding Run Name to title
'#    e.g. "K:\My Tests\ClmMHS_030202wc.xls" becomes "C:\Temp\ClmMHS_030202wc_01 Apr 02_15 08 22.xls"
'#     Create final path name for data table (used by f_eCP_SetupRunResultsII at end of run)
'#    e.g. in the example above, "K:\My Tests\TestRuns\ClmMHS_030202wc_01 Apr 02_15 08 22.xls"
'#   
'#  See also: f_SetupRunResultsII
'#  
'#############################################################################################

  function f_SetupRunResultsI()
 Dim tFileName, tarFileName, tFileNametxt,tRunName, tFileNametxt_inTemp

 tRunName = Environment("kRunName")
 tFilePath = Environment.Value("KDataTable")
 
 tarFilePath=split(tFilePath ,"")
 
      tFileNametxt = split(tarFilePath(ubound(tarFilePath)),".")
 tNewfileName = tFileNametxt(0) & "_" & tRunName &".xls"
 

 tFileNamePath_inTemp = "C:Temp" & tFileNametxt(0) &".xls"
 tNewFileNamePath = "C:Temp"& tNewfileName
 

    ' Check if TestRuns folder is present if not create a folder with name "TestRuns"
 tarFilePathFolder = ""
 tcount1 = ubound(tarFilePath) - 1
 for i = 0 to tcount1
  if(i = 0) then
    tarFilePathFolder = tarFilePath(i)
  else
    tarFilePathFolder = tarFilePathFolder & ""& tarFilePath(i)
  end if
 Next
 tarFilePathFolder = tarFilePathFolder&""
 
 call f_AddNewFolder (tarFilePathFolder, "TestRuns")
 
    'Copy the file to Temp
 Const OverwriteExisting = TRUE
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 objFSO.CopyFile tFilePath  , "C:Temp", OverwriteExisting
   
    'Rename it by adding the run name
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 objFSO.MoveFile (tFileNamePath_inTemp) , (tNewFileNamePath )
 set objFSO = nothing
    'Make it an environment variable for use in all actions.
 Environment.Value("KDataTableNew")  = tNewFileNamePath
 
     'Copy the Macro file to Temp
 tMacropath = Environment("fpathMacro")
 tMacro = tMacropath &"Macros.xls"
 
 
 Set objFSO2 = CreateObject("Scripting.FileSystemObject")
 objFSO2.CopyFile tMacro, "C:Temp", OverwriteExisting
 'msgbox "Did i copy the Macro"

  end function

'#############################################################################################
'#
'#  f_SetupRunResultsII()
'#  
'#  
'#
'# NOTE: 
'#     -> f_SetupRunResultsI is used in conjunction with 'f_SetupRunResultsII',
'#   which is run at the end of the script, to move the completed results
'#   table from local drive to its final destination
'#
'#  
'#  
'#############################################################################################

  function f_SetupRunResultsII()
 msgbox(" I am in setuprunresultsII")
 Dim tFileName, tarFileName, tFileNametxt,tRunName, tFileNametxt_inTemp

 tRunName = Environment("kRunName")
 tFilePath = Environment.Value("KDataTable")
 
 tarFilePath=split(tFilePath ,"")
 
      tFileNametxt = split(tarFilePath(ubound(tarFilePath)),".")
 tNewfileName = tFileNametxt(0) & "_" & tRunName &".xls"
 

 tFileNamePath_inTemp = "C:Temp" & tFileNametxt(0) &".xls"
 tNewFileNamePath = "C:Temp"& tNewfileName

 tarFilePathFolder = ""
 tcount1 = ubound(tarFilePath) - 1
 for i = 0 to tcount1
  if(i = 0) then
    tarFilePathFolder = tarFilePath(i)
  else
    tarFilePathFolder = tarFilePathFolder & ""& tarFilePath(i)
  end if
 Next
 tarFilePathFolder = tarFilePathFolder&"TestRuns"

    'Copy the file to TestRuns
 Const OverwriteExisting = TRUE
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 objFSO.CopyFile tNewFileNamePath  , tarFilePathFolder, OverwriteExisting
 set objFSO = nothing
 

  end function

'#############################################################################################
'#
'#  f_CloseOpenBrowsers()
'#  
'# Close any open browsers
'#
'#############################################################################################
 Function f_CloseOpenBrowsers()

 For each Process in GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery ("select * from Win32_Process where Name='iexplore.exe'")
  Process.Terminate
 Next
 'do while("True")
   '   TrueOrFlase = Browser("index:=0").Exist(0)
   ' if(TrueOrFlase = "False") then
      '  exit do
   ' else
      '  Browser("index:=0").close
        '        end if
 'loop
   End Function
  'function f_CloseOpenBrowsers()
' do while("True")
'      TrueOrFlase = Browser("index:=0").Exist(0)
'    if(TrueOrFlase = "False") then
'        exit do
'    else
'        Browser("index:=0").close
''                end if
' loop
'   end function

'#############################################################################################
'#
'#  f_InitializeArrays_MedClaim()
'#  
'# NOTE: The arField array lists all of the data elements to be verified and/or input.
'# These data elements are used for:
'#   - headers for each column on the data table
'#   - array elements in the arExp and arAct arrays
'#
'#############################################################################################

  function f_InitializeArrays_MedClaim()
  
    '******************************
    ' Testcase data
    '******************************

    arField(1)   = "TestNm"
 arField(2)   = "TestScenario"
 arField(3)   = "ExpRes"
    arField(4)   = "SrcSys"
    arField(5)   = "Run"
    arField(6)  = "Result"
    arField(7)   = "ErrMsg_Scr"
 arField(8)  = "ErrMsg" 
    arField(9) = "ErrScr"
 arField(10)  = "Ver_Code"
 arField(11) = "SrchTyp"
 
             
 
    '******************************
    ' Input data
    '******************************
 arInp(0) = 12
     arField(12) = "Input"    ' Column Header
 arInp(1) = 12

 arInp(2) = 13
     arField(13)   = "SSOID"      
     arField(14)   = "SSOPwd"
  arField(15) = "PatientName"
  arField(16) = "ClmDtRng"
  arField(17) = "ClmDtStart" 
  arField(18) = "ClmDtEnd" 
 arInp(3) = 18

    '******************************
    ' Patient Data
    '******************************
    arPat(0) = 19
      arField(19) = "Patient1"  ' Column Header
 arPat(1)  = 19

 arPat(2) = 20
   arField(20)   = "PatientName" 
      arField(21)   = "Plan"
      arField(22)   = "PharmacyPlan"
      arField(23)   = "ActNum"
      arField(24)   = "EffDt"
      arField(25) = "EligStatus"
      arField(26)   = "CovEndDt"
    arPat(3) = 26

    '******************************
    ' Claim Summary Data
    '******************************
 arClmSummary(0) = 30
      arField(30)  = "NumClm"  ' counter field
      arField(31)  = "VerifyClaim"
      arField(32)  = "SumClmNum"
      arField(33)  = "SumDOS"
   arField(34)  = "SumSerProvider"
   arField(35)  = "SumStatus"
   arField(36)  = "SumSubCharge"
    arField(37)  = "SumPdPlan"
      arField(38)  = "SumPdHRA"
   arField(39)  = "SumFSA"
   arField(40)  = "SumHAA"
   arField(41)  = "SumMemResp"
 arClmSummary(1) = 41 

    '******************************
    ' Claim Detail Data
    '******************************

 arClmDtl(0) = 45
   arField(45)  = "NumDet"  ' counter field
   arField(46)  = "DtlService"
   arField(47)  = "DtlDOS"
   arField(48)  = "DtlSubCharge"
   arField(49)  = "DtlNegDiscount"
   arField(50)  = "DtlNotCov"
   arField(51)  = "DtlCopayDed"
   arField(52)  = "DtlMemCopay"  
   arField(53)  = "DtlCovBalance"
   arField(54)  = "DtlCignaCoins"
   arField(55)  = "DtlMemberCoins"
   arField(56)  = "DtlPdFSA"
   arField(57)  = "DtlPdHRA"
   arField(58)  = "DtlPdHAA"
   arField(59)  = "DtlMemResp"  
   arField(60)  = "DtlRemarks"
 arClmDtl(1) = 60

 arClmDtl(2) = 65
   arField(65)  = "DtlClmMem"
   arField(66)  = "DtlClmDOS"
   arField(67)  = "DtlClmRecDt"
   arField(68)  = "DtlClmPrcDt"
   arField(69)  = "DtlClmServPrv"
   arField(70)  = "DtlClmNtwkInd"
   arField(71)  = "DtlClmStatus"
 arClmDtl(3) = 71

 arClmDtl(4)     = 73
   arField(73)  = "PmtCOBInd"
   arField(74)  = "PmtOIConsdr"
   arField(75)  = "PmtOIPaid"
   arField(76)  = "NumChk"
   arField(77)  = "PmtCignaPd"
   arField(78)  = "PmtPaidTo"
   arField(79)  = "PmtPayAddr"
   arField(80)  = "PmtChkNum"
   arField(81)  = "PmtChkStat"
   arField(82)  = "PmtHRAPd"
   arField(83)  = "PmtHRAType"
   arField(84)  = "PmtFSAPd"
   arField(85)  = "PmtHAAPd"
 arClmDtl(5) = 85


 arClmDtl(6) = 86
   arField(86)  = "NumRmk"  ' Counter field
   arField(87)  = "RmkCd"
   arField(88)  = "RmkCdAmt"
   arField(89)  = "RmkCdExpl"
 arClmDtl(7) = 89
  
  end function

'#############################################################################################
'#
'#  f_InitializeArrays_DenClaim()
'#  
'# NOTE: The arField array lists all of the data elements to be verified and/or input.
'# These data elements are used for:
'#   - headers for each column on the data table
'#   - array elements in the arExp and arAct arrays
'#
'#############################################################################################

  function f_InitializeArrays_DenClaim()
 
  ''******************************
  ' Testcase data
  '******************************

  arField(1)   = "TestNm"
  arField(2)   = "TestScenario"
  arField(3)   = "ExpRes"
  arField(4)   = "SrcSys"
  arField(5)   = "Run"
  arField(6)   = "Result"
  arField(7)   = "ErrMsg_Scr"
  arField(8)   = "ErrMsg" 
  arField(9)  = "ErrScr"
  arField(10)    = "Ver_Code"
  arField(11)  = "SrchTyp"
 
             
 
  '******************************
  ' Input data
  '******************************
  arInp(0) = 12
   arField(12) = "Input"    ' Column Header
  arInp(1) = 12
 
  arInp(2) = 13
   arField(13)   = "SSOID"      
   arField(14)   = "SSOPwd"
   arField(15) = "PatientName"
   arField(16) = "ClmDtRng"
   arField(17) = "ClmDtStart" 
   arField(18) = "ClmDtEnd" 
  arInp(3) = 18

  '******************************
  ' Patient Data
  '******************************
  arPat(0) = 19
    arField(19) = "Patient1"  ' Column Header
  arPat(1)  = 19
 
  arPat(2) = 20
    arField(20)   = "PatientName" 
    arField(21)   = "Plan"
    arField(22)   = "PharmacyPlan"
    arField(23)   = "ActNum"
    arField(24)   = "NtwkNm"
    arField(25)   = "EffDt"
    arField(26) = "EligStatus"
    arField(27)   = "CovEndDt"
  arPat(3) = 27

  '******************************
  ' Claim Summary Data
  '******************************
  arClmSummary(0) = 30
    arField(30)  = "NumClm"  ' counter field
    arField(31)  = "VerifyClaim"
    arField(32)  = "SumClmNum"
    arField(33)  = "SumDOS"
    arField(34)  = "SumSerProvider"
    arField(35)  = "SumStatus"
    arField(36)  = "SumSubCharge"
    arField(37)  = "SumPdPlan"
        arClmSummary(1) = 37 

  '******************************
  ' Claim Detail Data
  '******************************
 
  arClmDtl(0) = 45
    arField(45)  = "NumDet"  ' counter field
    arField(46)  = "DtlService"
    arField(47)  = "DtlToothNum"
    arField(48)  = "DtlDOS"
    arField(49)  = "DtlSubCharge"
    arField(50)  = "DtlNegDiscount"
          arField(51)  = "DtlNotCov"
    arField(52)  = "DtlCopayDed"
    arField(53)  = "DtlMemCopay"
          arField(54)  = "DtlCovBalance"
    arField(55)  = "DtlCignaCoins"
    arField(56)  = "DtlMemberCoins"
          arField(57)  = "DtlRemarks"
  arClmDtl(1) = 57
 
  arClmDtl(2) = 65
    arField(65)  = "DtlClmMem"
    arField(66)  = "DtlClmDOS"
    arField(67)  = "DtlClmRecDt"
    arField(68)  = "DtlClmPrcDt"
    arField(69)  = "DtlClmServPrv"
    arField(70)  = "DtlClmNtwkInd"
    arField(71)  = "DtlClmStatus"
  arClmDtl(3) = 71
 
  arClmDtl(4)     = 73
    arField(73)  = "PmtCOBInd"
    arField(74)  = "PmtOIConsdr"
    arField(75)  = "PmtOIPaid"
    arField(76)  = "NumChk"
    arField(77)  = "PmtCignaPd"
    arField(78)  = "PmtPaidTo"
    arField(79)  = "PmtPayAddr"
    arField(80)  = "PmtChkNum"
    arField(81)  = "PmtChkStat"
    arField(82)  = "PmtHRAPd"
    arField(83)  = "PmtHRAType"
    arField(84)  = "PmtFSAPd"
    arField(85)  = "PmtHAAPd"
  arClmDtl(5) = 85
 
 
  arClmDtl(6) = 86
    arField(86)  = "NumRmk"  ' Counter field
    arField(87)  = "RmkCd"
    arField(88)  = "RmkCdAmt"
    arField(89)  = "RmkCdExpl"
  arClmDtl(7) = 89

  end function

'#############################################################################################
'#
'#  f_InitializeArrays_MedCT()
'#  
'# NOTE: The arField array lists all of the data elements to be verified and/or input.
'# These data elements are used for:
'#   - headers for each column on the data table
'#   - array elements in the arExp and arAct arrays
'#
'#############################################################################################

  function f_InitializeArrays_MedCT()
 
    '******************************
    ' Testcase data
    '******************************

    arField(1)   = "TestNm"
 arField(2)   = "ExpRes"
    arField(3)   = "SrcSys"
    arField(4)   = "Run"
    arField(5)  = "Ver_Code"
    arField(6)  = "Result"
    arField(7)   = "ErrMsg_Scr"
    arField(8)  = "ErrMsg" 
    arField(9) = "ErrScr"          
 
    '******************************
    ' Input data
    '******************************
 arInp(0) = 11
     arField(11) = "Patient1"    ' Column Header
 arInp(1) = 11

 arInp(2) = 12
     arField(12)   = "SSOID"      
     arField(13)   = "SSOPwd"
  arField(14) = "InfoYear"
 arInp(3) = 14

    '******************************
    ' Patient Data
    '******************************
    arPat(0) = 15
      arField(15) = "VerifyMemInfo"  ' Column Header
 arPat(1)  = 15

 arPat(2) = 16
   arField(16)   = "PatientName" 
      arField(17)   = "Plan"
      arField(18)   = "PharmacyPlan"
      arField(19)   = "ActNum"
      arField(20)   = "EffDt"
      arField(21) = "EligStatus"
      arField(22)   = "CovEndDt"
      arField(23)  = "#ofMem"
 arPat(3) = 23


 arPat(4) = 25
      arField(25) = "Patient2"   ' Column Header
 arPat(5) = 25

 arPat(6) = 26
      arField(26) = "OtherMembers"
 arPat(7) = 26

    '******************************
    ' Cost Tracker Summary Page data
    '******************************
 arBen(0) = 30
      arField(30)  = "NumCTSum"  ' counter field
      arField(31)  = "VerifyCTSum"
      arField(32)  = "CTSum_InName"
      arField(33)  = "CTSum_InAmt"
   arField(34)  = "CTSum_InMet"
   arField(35)  = "CTSum_InRem"
   arField(36)  = "CTSum_OutName"
   arField(37)  = "CTSum_OutAmt"
   arField(38)  = "CTSum_OutMet"
   arField(39)  = "CTSum_OutRem"
 arBen(1) = 39
    '******************************
    ' Cost Tracker Detail Page data
    '****************************** 

 arBen(2) = 40
   arField(40)  = "NumCTDtl"  ' counter field
   arField(41)  = "VerifyCTDtl"
   arField(42)  = "CTDtlName"
   arField(43)  = "CTDtl_InAmt"
   arField(44)  = "CTDtl_InMet"
   arField(45)  = "CTDtl_InRem"
   arField(46)  = "CTDtl_OutAmt"
   arField(47)  = "CTDtl_OutMet"
   arField(48)  = "CtDtl_OutRem"
 arBen(3) = 48

   end function
'   #############################################################################################
'#
'#  f_InitializeArrays_DenCT()
'#  
'# NOTE: The arField array lists all of the data elements to be verified and/or input.
'# These data elements are used for:
'#   - headers for each column on the data table
'#   - array elements in the arExp and arAct arrays
'#
'#############################################################################################

  function f_InitializeArrays_DenCT()
 
    '******************************
    ' Testcase data
    '******************************

    arField(1)   = "TestNm"
 arField(2)   = "ExpRes"
    arField(3)   = "SrcSys"
    arField(4)   = "Run"
    arField(5)   = "Ver_Code"
    arField(6)   = "Result"
    arField(7)   = "ErrMsg_Scr"
    arField(8)   = "ErrMsg" 
    arField(9)  = "ErrScr"          
 
    '******************************
    ' Input data
    '******************************
 arInp(0) = 11
     arField(11) = "Patient1"    ' Column Header
 arInp(1) = 11

 arInp(2) = 12
     arField(12)   = "SSOID"      
     arField(13)   = "SSOPwd"
    arInp(3) = 13

    '******************************
    ' Patient Data
    '******************************
    arPat(0) = 15
      arField(15) = "VerifyMemInfo"  ' Column Header
 arPat(1)  = 15

 arPat(2) = 16
  arField(16)   = "PatientName" 
  arField(17)   = "Plan"
  arField(18)   = "PharmacyPlan"
  arField(19)   = "ActNum"
  arField(20)  = "NtwkName"
  arField(21)   = "EffDt"
  arField(22) = "EligStatus"
  arField(23)   = "CovEndDt"
  arField(24)  = "#ofMem"
 arPat(3) = 24
   'arField(16)   = "PatientName" 
      'arField(17)   = "Plan"
      'arField(18)   = "PharmacyPlan"
      'arField(19)   = "ActNum"
     ' arField(20)   = "EffDt"
      'arField(21) = "EligStatus"
      'arField(22)   = "CovEndDt"
      'arField(23)  = "#ofMem"
 'arPat(3) = 23


 arPat(4) = 25
      arField(25) = "Patient2"   ' Column Header
 arPat(5) = 25

 arPat(6) = 26
      arField(26) = "OtherMembers"
 arPat(7) = 26

    '******************************
    ' Cost Tracker Summary Page data
    '******************************
 arBen(0) = 30
      arField(30)  = "NumCTSum"  ' counter field
      arField(31)  = "VerifyCTSum"
      arField(32)  = "CTSum_InName"
      arField(33)  = "CTSum_InAmt"
   arField(34)  = "CTSum_InMet"
   arField(35)  = "CTSum_InRem"
   arField(36)  = "CTSum_OutName"
   arField(37)  = "CTSum_OutAmt"
   arField(38)  = "CTSum_OutMet"
   arField(39)  = "CTSum_OutRem"
 arBen(1) = 39
    '******************************
    ' Cost Tracker Detail Page data
    '****************************** 

 arBen(2) = 40
   arField(40)  = "NumCTDtl"  ' counter field
   arField(41)  = "VerifyCTDtl"
   arField(42)  = "CTDtlName"
   arField(43)  = "CTDtl_InAmt"
   arField(44)  = "CTDtl_InMet"
   arField(45)  = "CTDtl_InRem"
   arField(46)  = "CTDtl_OutAmt"
   arField(47)  = "CTDtl_OutMet"
   arField(48)  = "CtDtl_OutRem"
 arBen(3) = 48

   end function

'#############################################################################################
'#
'#  f_InitializeArrays_MedEB()
'#  
'# NOTE: The arField array lists all of the data elements to be verified and/or input.
'# These data elements are used for:
'#   - headers for each column on the data table
'#   - array elements in the arExp and arAct arrays
'#
'#############################################################################################

  function f_InitializeArrays_MedEB()
 
    '******************************
    ' Testcase data
    '******************************

    arField(1)   = "TestNm"
 arField(2)   = "ExpRes"
    arField(3)   = "SrcSys"
    arField(4)   = "Run"
    arField(5)  = "Ver_Code"
    arField(6)  = "Result"
    arField(7)   = "ErrMsg_Scr"
    arField(8)  = "ErrMsg" 
    arField(9) = "ErrScr"          
 
    '******************************
    ' Input data
    '******************************
 arInp(0) = 11
     arField(11) = "Patient1"    ' Column Header
 arInp(1) = 11

 arInp(2) = 12
     arField(12)   = "SSOID"      
     arField(13)   = "SSOPwd"
  arField(14) = "PatientName"
 arInp(3) = 14

    '******************************
    ' Patient Data
    '******************************
    arPat(0) = 15
      arField(15) = "VerifyMemInfo"  ' Column Header
 arPat(1)  = 15

 arPat(2) = 16
   arField(16)   = "PatientName" 
      arField(17)   = "Plan"
      arField(18)   = "PharmacyPlan"
      arField(19)   = "ActNum"
      arField(20)   = "EffDt"
      arField(21) = "EligStatus"
      arField(22)   = "CovEndDt"
      arField(23)  = "#ofMem"
 arPat(3) = 23


 arPat(4) = 25
      arField(25) = "Patient2"   ' Column Header
 arPat(5) = 25

 arPat(6) = 26
      arField(26) = "OtherMembers"
 arPat(7) = 26

    '******************************
    ' Benefits data
    '******************************
 arBen(0) = 30
      arField(30)  = "NumMedBen"  ' counter field
      arField(31)  = "VerifyMedBen"
      arField(32)  = "MedBenefit"
      arField(33)  = "MedAmt1"
   arField(34)  = "MedAmt2"
   arField(35)  = "MedAmt3"
   arField(36)  = "MedAmt4"
 arBen(1) = 36 

 arBen(2) = 40
   arField(40)  = "NumVisBen"  ' counter field
   arField(41)  = "VerifyVisBen"
   arField(42)  = "VisBenefit"
   arField(43)  = "VisAmt1"
   arField(44)  = "VisAmt2"
   arField(45)  = "VisAmt3"
   arField(46)  = "VisAmt4"
 arBen(3) = 46

 arBen(4) = 50
   arField(50)  = "NumMenBen"  ' Counter field
   arField(51)  = "VerifyMenBen"
   arField(52)  = "MenBenefit"
   arField(53)  = "MenAmt1"
   arField(54)  = "MenAmt2"
 arBen(5) = 54

   end function

'#############################################################################################
'#
'#   f_InitializeArrays_DenEB()
'#  
'# NOTE: The arField array lists all of the data elements to be verified and/or input.
'# These data elements are used for:
'#   - headers for each column on the data table
'#   - array elements in the arExp and arAct arrays
'#
'#############################################################################################

  function  f_InitializeArrays_DenEB()

    '******************************
    ' Testcase data
    '******************************

    arField(1)   = "TestNm"
 arField(2)   = "ExpRes"
    arField(3)   = "SrcSys"
    arField(4)   = "Run"
    arField(5)  = "Ver_Code"
    arField(6)  = "Result"
    arField(7)   = "ErrMsg_Scr"
    arField(8)  = "ErrMsg" 
    arField(9) = "ErrScr"          
 
    '******************************
    ' Input data
    '******************************
 arInp(0) = 11
     arField(11) = "Patient1"    ' Column Header
 arInp(1) = 11

 arInp(2) = 12
     arField(12)   = "SSOID"      
     arField(13)   = "SSOPwd"
  arField(14) = "PatientName"
 arInp(3) = 14

    '******************************
    ' Patient Data
    '******************************
    arPat(0) = 15
      arField(15) = "VerifyMemInfo"  ' Column Header
 arPat(1)  = 15

 arPat(2) = 16
   arField(16)   = "PatientName" 
      arField(17)   = "Plan"
      arField(18)   = "PharmacyPlan"
      arField(19)   = "ActNum"
   arField(20)  = "NtwkName"
      arField(21)   = "EffDt"
      arField(22) = "EligStatus"
      arField(23)   = "CovEndDt"
      arField(24)  = "#ofMem"
 arPat(3) = 24


 arPat(4) = 25
      arField(25) = "Patient2"   ' Column Header
 arPat(5) = 25

 arPat(6) = 26
      arField(26) = "OtherMembers"
 arPat(7) = 26

    '******************************
    ' Benefits data
    '******************************
 arBen(0) = 30
      arField(30)  = "NumMedBen"  ' counter field
      arField(31)  = "VerifyMedBen"
      arField(32)  = "MedBenefit"
      arField(33)  = "MedAmt1"
   arField(34)  = "MedAmt2"
 arBen(1) = 34 

  end function

'#############################################################################################
'#
'#   f_InitializeArrays_PharmEB()
'#  
'# NOTE: The arField array lists all of the data elements to be verified and/or input.
'# These data elements are used for:
'#   - headers for each column on the data table
'#   - array elements in the arExp and arAct arrays
'#
'#############################################################################################

  function f_InitializeArrays_PharmEB()
 


  end function

'#############################################################################################
'#
'#   f_InitializeArrays_PharmClaim()
'#  
'# NOTE: The arField array lists all of the data elements to be verified and/or input.
'# These data elements are used for:
'#   - headers for each column on the data table
'#   - array elements in the arExp and arAct arrays
'#
'#############################################################################################

  function  f_InitializeArrays_PharmClaim()
 


  end function

'#############################################################################################
'#
'#   f_ClearArray( )
'#       Clears the contents of arrays
'#  
'#############################################################################################
  function f_ClearArray( )
  
  tMax1 = ubound(arAct,1)
  tMax2 = ubound(arAct,2)
  
  for j = 1 to tMax1
      for i = 1 to tMax2    
   arAct(j,i) = ""
      Next
  Next
  
  tMax1 = ubound(arExp,1)
  tMax2 = ubound(arExp,2)
  
  for j = 1 to tMax1
      for i = 1 to tMax2    
   arExp(j,i) = ""
      Next
  Next

  
  tMax = ubound(arInput)
  for j = 1 to tMax    
   arInput(j) = ""
  Next
  end function

'#############################################################################################
'#
'#   f_ClearClmArray( )
'#       Clears the contents of arrays
'#  
'#############################################################################################
  function f_ClearClmArray( )
  
  tMax1 = ubound(arClmAct,1)
  tMax2 = ubound(arClmAct,2)
  tMax3 = ubound(arClmAct,3)
  
  for j = 1 to tMax1
      for i = 1 to tMax2
   for k = 1 to tMax3    
      arClmAct(j,i ,k) = ""
   Next
      Next
  Next
  
  tMax1 = ubound(arClmExp,1)
  tMax2 = ubound(arClmExp,2)
  tMax3 = ubound(arClmExp,3)
  
  for j = 1 to tMax1
      for i = 1 to tMax2
   for k = 1 to tMax3    
      arClmExp(j,i ,k) = ""
   Next
      Next
  Next

  
  tMax = ubound(arInput)
  for j = 1 to tMax    
   arInput(j) = ""
  Next
  end function

'#############################################################################################
'#   Function: f_PrintLog
'#       This function is similar to WinRunner's print function, except it outputs data to a
'# Notepad window.The performance is not as fast as the WinRunner's print function, but
'# its a good way to monitor output while running a test instead of using a msgbox.
'#      The "LogFile.txt" is saved to the testname directory. You can easily change the location
'# of where the log file is saved by modifying the LogFile
'#############################################################################################

Function f_PrintLog (Message)
     LogFile = Environment.Value("TestDir") & "LogFile.txt"
     f_ForWriting = 2 ' use 2 for (over) writing, 8 for appending

     If (Window("regexpwndclass:=Notepad", "regexpwndtitle:=Notepad").Exist = False) Then
         Set fso = CreateObject("Scripting.FileSystemObject")
         Set OutputFile = fso.OpenTextFile (LogFile, f_ForWriting, True)
         OutputFile.WriteLine Now
         OutputFile.Close
        wait 1
         SystemUtil.Run "Notepad", LogFile
     End If

     Window("regexpwndclass:=Notepad", "regexpwndtitle:=Notepad").Activate
     set WshShell = CreateObject("WScript.Shell")
   
     'Navigate to last line in Notepad window
     WshShell.SendKeys "^a" 'Select All (Ctrl + A)
     WshShell.SendKeys "{DOWN}" ' Down Arrow

     Window("regexpwndclass:=Notepad", "regexpwndtitle:=Notepad").WinEditor("nativeclass:=Edit").Type Message & MicReturn

     Set WshShell = Nothing
     'set WshShell = CreateObject("WScript.Shell")
     'WshShell.SendKeys "^s" 'Save (Ctrl + S)
     'Set WshShell = Nothing
End Function

'#############################################################################################
'#   Function: f_SavePrintLog
'#       This function is used in conjuction with f_PrintLog. This function is kept seperate
'#   in order to improve performance.
'#############################################################################################
Function f_SavePrintLog ()
     
     Window("regexpwndclass:=Notepad", "regexpwndtitle:=Notepad").Activate
     set WshShell = CreateObject("WScript.Shell")
         
     Set WshShell = Nothing
     set WshShell = CreateObject("WScript.Shell")
     WshShell.SendKeys "^s" 'Save (Ctrl + S)
     Set WshShell = Nothing
End Function

'#############################################################################################
'#   Function: f_Whichwindow
'#      
'#############################################################################################

Function f_Whichwindow()
  vWin = ""
 
     if Browser("Browser").Page("Consumer Portal Home").Exist then
    if Browser("Browser").Page("Consumer Portal Home").WebElement("Error").Exist then
     vWin = "Consumer Portal Home - Error"
    else
     vWin = "Consumer Portal Home"
    end if
  elseif browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_HomePage").Link("lnk_Welcome").Exist(0)  then
      vWin = "myCIGNA_Homepage"
  elseif browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").WebElement("lnk_Medical benefit details").Exist(0) then
    vWin = "myCIGNA_Summary"
  elseif browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_MemberSummary").WebTable("Last Name").Exist(0) then
    vWin = "myCIGNA_MemberSummary"
  elseif browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_BenefitsDetails").WebElement("Err_Temporarily Unavailable").Exist(0) then
    vWin = "myCIGNA_BenefitsDetails_Unavailable"
   elseif browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_BenefitsDetails").WebTable("tbl_MedBenefits").Exist(0) then
    vWin = "myCIGNA_BenefitsDetails"
  elseif browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_Vision").WebTable("tbl_Vision").exist(0) then
    vWin = "myCIGNA_Vision"
  elseif browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_MentalHealth").WebTable("tbl_Mental Health").Exist(0) then
    vWin = "myCIGNA_MentalHealth"
  else
    vWin = "Unexpected Window"
     end if
End Function

'#############################################################################################
'#   Function: f_ClmWhichwindow
'#      
'#############################################################################################

'Function f_ClmWhichwindow()
 
 'vWin = ""

 '    if Browser("Browser").Page("Consumer Portal Home").Exist then
 ' if Browser("Browser").Page("Consumer Portal Home").WebElement("Error").Exist then
 '  vWin = "Consumer Portal Home - Error"
 ' else
 ''  vWin = "Consumer Portal Home"
 ' end if
 '   elseif browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").WebElement("lnk_Medical benefit details").Exist then
 ' vWin = "myCIGNA_Summary"
 '    elseif browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_MemberSummary").WebTable("Last Name").Exist then
 ' vWin = "myCIGNA_MemberSummary"
 '    elseif browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_BenefitsDetails").WebTable("tbl_MedBenefits").Exist then
 ' vWin = "myCIGNA_BenefitsDetails"
 '    elseif browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_Vision").WebTable("tbl_Vision").exist then
 ' vWin = "myCIGNA_Vision"
 '    elseif browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_MentalHealth").WebTable("tbl_Mental Health").Exist then
 ' vWin = "myCIGNA_MentalHealth"
 '    else
 ' vWin = "Unexpected Window"
 '    end if

 '    msgbox " The window is" & vWin

  
   
 ' 
  'myCIGNA_Summary
  'myCIGNA_MemberSummary
  'myCIGNA_BenefitsDetails
 'end if
'End Function
'#############################################################################################
'#   Function: f_arraypossiblewindows
'#      
'#############################################################################################

function f_arraypossiblewindows()


end function

'#############################################################################################
'#   Function: f_SelectListItem
'#      
'#############################################################################################

public function f_SelectListItem(obj, mySubstr)
   'grab list contents (will be semi-colon delimited)
   listContents = obj.GetROProperty ("all items")
   'split list contents into individual array elements
   listArr = split(listContents, ";", -1, 1)

   for i=1 to UBound (listArr)
      'check if your string matches and begins on first character of list item
      'if so, then it is a match
      if (InStr(1, listArr(i), mySubstr, 1) = 1) then
         obj.Select (listArr(i))
         matchListItem = 0
      end if
   next
End Function


'#############################################################################################
'#   Function: f_SelectCalendarDate
'#      
'#############################################################################################

Function f_SelectCalendarDate(tcalendar, tcalendardate)

 tdate = tcalendardate
 tcal = tcalendar
 arrdate = split(tdate,"/")
 tmonth = arrdate(0)
 tmonthname = MonthName(tmonth)
 tMonYear = tmonthname &" "&arrdate(2)
 
 If tcal = 1 Then
  tdate1 = Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNAClmAdvSrch").WebEdit("fromDate").GetROProperty("value")
  Browser("myCIGNA").Page("myCIGNA_3").Frame("myCIGNAClmAdvSrch").Image("Img_calendar").Click 
  elseif tcal = 2 then
  tdate1 = Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNAClmAdvSrch").WebEdit("toDate").GetROProperty("value")
  Browser("myCIGNA").Page("myCIGNA_3").Frame("myCIGNAClmAdvSrch").Image("Img_calendar_2").Click
  End If
 
  tdate = cdate(tdate)
 
  x = datediff("d", tdate, tdate1)
  text = Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNAClmAdvSrch").WebElement("Month Year").GetROProperty("innertext")

  tcounter = 1
 
  If tMonYear text Then
  Do
   'msgbox ttime
    if x > 0 then
    Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNAClmAdvSrch").WebButton("   elseif x     Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNAClmAdvSrch").WebButton(">").Click
   end if
          text = Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNAClmAdvSrch").WebElement("Month Year").GetROProperty("innertext")
   If tMonYear = text Then
    Exit do
   end if
   tcounter = tcounter + 1
  Loop Until  tcounter = 48

  End if

 tdateobj = "<_> Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNAClmAdvSrch").WebElement(tdateobj).click


 
'If tcal = 1 Then
' Browser("myCIGNA").Page("myCIGNA_3").Frame("myCIGNAClmAdvSrch").Image("Img_calendar").Click
'elseif tcal = 2 then
' Browser("myCIGNA").Page("myCIGNA_3").Frame("myCIGNAClmAdvSrch").Image("Img_calendar_2").Click
'End If

'text = Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNAClmAdvSrch").WebElement("Month Year").GetROProperty("innertext")
'msgbox text

'tcounter = 1
'ttime = now

'If tMonYear text Then
 'Do
  'msgbox ttime
  'Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNAClmAdvSrch").WebButton("         'text = Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNAClmAdvSrch").WebElement("Month Year").GetROProperty("innertext")
  'ttime = now
  'msgbox ttime
  'If tMonYear = text Then
  ' Exit do
  'end if
  'msgbox "to set "&tMonYear & " text :"& text
        'tcounter = tcounter + 1
 'Loop Until  tcounter = 48
'End If

'tdateobj = "<_>'msgbox tdateobj
'Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNAClmAdvSrch").WebElement(tdateobj).click


end function
'#############################################################################################
'#   Function: f_ClmWhichwindow
'#      
'#############################################################################################

Function f_ClmWhichwindow (tWin1,tWin2,tWin3,tWin4)
 
 
 vWin = ""
 tarWin = Array(tWin1, tWin2, tWin3, tWin4 )
 
 for i = 0 to 3
   Select Case tarWin(i)
  Case "Consumer Portal Home"
   'msgbox " I went in CP HOME section"
   if Browser("Browser").Page("Consumer Portal Home").Exist(25) then
    if Browser("Browser").Page("Consumer Portal Home").WebElement("Error").Exist(20) then
     'msgbox " I went in CP ERROR section"
     vWin = "Consumer Portal Home - Error"
     'msgbox " The window is" & vWin
     Exit for
    else
     'msgbox " i went in CP home else section"
     vWin = "Consumer Portal Home"
     'msgbox " The window is" & vWin
     Exit for
    end if
   end if

  Case "myCIGNA_Home"
   If browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_HomePage").Link("lnk_Welcome").Exist(25)  Then
     vWin = "myCIGNA_Home"
     Exit for
   End If
  Case "myCIGNA_Summary"
   if browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").WebElement("lnk_Medical benefit details").Exist(25) then
      vWin = "myCIGNA_Summary"
      'msgbox " The window is" & vWin
      Exit for
   end if 
   
  Case "myCIGNA_AdvancedClmSearch"
   if browser("myCIGNA").Page("myCIGNA_3").Frame("myCIGNAClmAdvSrch").Exist(25) then
    tcheck1 = browser("myCIGNA").Page("myCIGNA_3").Frame("myCIGNAClmAdvSrch").WebRadioGroup("rbtn_dateType").Exist(5)
    'msgbox tcheck1
    tcheck2 = Browser("myCIGNA").Page("myCIGNA_3").Frame("myCIGNAClmAdvSrch").Image("Img_calendar").Exist(1)
    'msgbox tcheck2
    tcheck3 = Browser("myCIGNA").Page("myCIGNA_3").Frame("myCIGNAClmAdvSrch").Image("Img_calendar_2").Exist(1)
    'msgbox tcheck3
   elseif Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_ClaimsSummary2").Exist(25) then
    tcheck4 = Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_ClaimsSummary2").WebElement("NoClaimsError").Exist(1)
    'msgbox tcheck4
   end if
   if tcheck1 = "True" and tcheck2 = "True" and tcheck3 = "True" then
    'msgbox "I am in this section after all three are TRUE"
       If  browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_ClaimsSummary2").WebElement("UnavailableError").Exist Then
      vWin = "myCIGNA_AdvancedClmSearch - Error1"
      Exit for
      elseif   browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNAClmAdvSrchErr").WebElement("tbl_Error").Exist then
     vWin = "myCIGNA_AdvancedClmSearch - Error"
     'msgbox " The window is" & vWin
     Exit for
    else
     vWin = "myCIGNA_AdvancedClmSearch"
     'msgbox " The window is" & vWin
     Exit for
    end if
   elseif tcheck4 = "True" then
    vWin = "myCIGNA_AdvancedClmSearch - NoClmError"
    'msgbox " The window is" & vWin
    Exit for
   end if
  Case "myCIGNA_ClaimSummary"
   if browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_ClaimsSummary").WebTable("tbl_Search Result").Exist(25) then
    vWin = "myCIGNA_ClaimSummary"
    'msgbox " The window is" & vWin
    Exit for
   end if
  Case "myCIGNA_ClaimDetails"
   if browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_ClaimDetails").WebTable("tbl_DetailLines").Exist(25) then
    vWin = "myCIGNA_ClaimDetails"
    'msgbox " The window is" & vWin
    Exit for
   end if
  Case ""
   'msgbox " i am in empty section"
  Case Else
   'msgbox " This window is not defined "
  End Select
 Next
 
 if vWin = "" then
  vWin = "UnExpected Window"
 end if
 'msgbox " The win before returning is " & vWin
  
 f_ClmWhichwindow = vWin


End Function

'#############################################################################################
'#   Function: f_MedCTWhichwindow
'#      
'#############################################################################################

Function f_MedCTWhichwindow (tWin1,tWin2,tWin3,tWin4)
 
 
 vWin = ""
 tarWin = Array(tWin1, tWin2, tWin3, tWin4 )
 
 for i = 0 to 3
   Select Case tarWin(i)
  Case "Consumer Portal Home"
   'msgbox " I went in CP HOME section"
   if Browser("Browser").Page("Consumer Portal Home").Exist(25) then
    if Browser("Browser").Page("Consumer Portal Home").WebElement("Error").Exist(20) then
     vWin = "Consumer Portal Home - Error"
                        Exit for
    else
                        vWin = "Consumer Portal Home"
                        Exit for
    end if
   end if
  Case "myCIGNA_Home"
   If browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_HomePage").Link("lnk_Welcome").Exist(25)  Then
    vWin = "myCIGNA_Home"
    Exit for
   End If
  Case "myCIGNA_Summary"
   check1 = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_MedCostTracker_Sum2").Link("lnk_View deductibles and maximums").Exist(30)
   check2 = browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").WebElement("lnk_Medical benefit details").Exist(5)
   if check1 = "True" then
       vWin = "myCIGNA_Summary"
                  Exit for
   elseif check1 = "False" and check2 ="True" then
    vWin = "myCIGNA_Summary1"
    Exit for
   end if 

  Case "myCIGNA_MemberSummary"
   if browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_MemberSummary").WebTable("Last Name").Exist then
    vWin = "myCIGNA_MemberSummary"
    Exit for
   end if
   
  Case "myCIGNA_CTDetails"
   tSelectYear = Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_MedCostTracker_Details").WebList("lst_InfoFor").Exist(10)
   tCTtable = Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_MedCostTracker_Details").WebTable("tbl_OutofPocketYTD").Exist(10)
     
   if tSelectYear = "True" and tCTtable = "True" then
    vWin = "myCIGNA_CTDetails"
    'msgbox " The window is" & vWin
    Exit for
   elseif tSelectYear = "True" and tCTtable = "False" then
    vWin = "myCIGNA_CTDetails_Error"
    Exit for
   end if
  Case ""
   'msgbox " i am in empty section"
  Case Else
   'msgbox " This window is not defined "
    End Select
 Next
 
 if vWin = "" then
  vWin = "UnExpected Window"
 end if
 'msgbox " The win before returning is " & vWin
  
 f_MedCTWhichwindow = vWin


End Function

'#############################################################################################
'#   Function: f_DenEBWhichwindow
'#      
'#############################################################################################

Function f_DenEBWhichwindow (tWin1,tWin2,tWin3,tWin4)
 
 
 vWin = ""
 tarWin = Array(tWin1, tWin2, tWin3, tWin4 )
 
 for i = 0 to 3
  'msgbox tarWin(i)
   Select Case tarWin(i)
  Case "Consumer Portal Home"
     if Browser("Browser").Page("Consumer Portal Home").Exist(25) then
        if Browser("Browser").Page("Consumer Portal Home").WebElement("Error").Exist(20) then
         vWin = "Consumer Portal Home - Error"
           Exit for
        else
         vWin = "Consumer Portal Home"
         Exit for
        end if
     end if
  Case "myCIGNA_Home"
     If browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_HomePage").Link("lnk_Welcome").Exist(25)  Then
       vWin = "myCIGNA_Home"
       Exit for
     End If
     
  Case "myCIGNA_DenSummary"
     texist = browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").Link("lnk_Dental").Exist(4)
     tselected = browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").Link("lnk_Dental").GetROProperty("class")
  
     If texist = "True" and  tselected = "selected" Then
        texist1 = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DentalSummary").Link("View your dental benefit").Exist
        If  texist1 = "True" Then
         vWin = "myCIGNA_DenSummary"
        else
         vWin = "myCIGNA_DenSummary1"
        end if
        Exit for
     elseif texist = "True" and  tselected = "" Then
        browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").Link("lnk_Dental").Click
        texist1 = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DentalSummary").Link("View your dental benefit").Exist
        If  texist1 = "True" Then
         vWin = "myCIGNA_DenSummary"
        else
         vWin = "myCIGNA_DenSummary1"
        end if
        Exit for
     elseif texist = "False" and tselected = "" then
        vWin = "myCIGNA_DenSummary_Unavailable"
        Exit for
        End If
   
   
  Case "myCIGNA_DentalMbrSummary"
   if browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DentalMbrSummary").WebTable("tbl_MbrInfo").Exist then
    vWin = "myCIGNA_DentalMbrSummary"
    Exit for
   end if
   
  
  Case "myCIGNA_DentalBenefitsDtls"
    ttblexist  =browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DenBenefitsDetails").WebTable("tbl_DenBenefits").Exist
    If ttblexist = "True" Then
     vWin = "myCIGNA_DentalBenefitsDtls"
     Exit for
               End If
   
  Case "myCIGNA_DentalCTDetails"
    
   tCTtable = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DenCostTracker_Details").WebTable("tbl_Details").Exist(10)
   tCTRows = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DenCostTracker_Details").WebTable("tbl_Details").RowCount
     
   if tCTRows > 6  and tCTtable = "True" then
    vWin = "myCIGNA_DentalCTDetails"
                Exit for
   elseif tCTRows     vWin = "myCIGNA_DentalCTDetails_Error"
    Exit for
   end if
  Case ""
   'msgbox " i am in empty section"
  Case Else
   'msgbox " This window is not defined "
    End Select
 Next
 
 if vWin = "" then
  vWin = "UnExpected Window"
 end if
 'msgbox " The win before returning is " & vWin
  
 f_DenEBWhichwindow = vWin


End Function

'#############################################################################################
'#   Function: f_DenCTWhichwindow
'#      
'#############################################################################################

Function f_DenCTWhichwindow (tWin1,tWin2,tWin3,tWin4)
 
 
 vWin = ""
 tarWin = Array(tWin1, tWin2, tWin3, tWin4 )
 
 for i = 0 to 3
  'msgbox tarWin(i)
     Select Case tarWin(i)
      Case "Consumer Portal Home"
        if Browser("Browser").Page("Consumer Portal Home").Exist(25) then
          if Browser("Browser").Page("Consumer Portal Home").WebElement("Error").Exist(20) then
            vWin = "Consumer Portal Home - Error"
              Exit for
          else
            vWin = "Consumer Portal Home"
            Exit for
          end if
        end if
      Case "myCIGNA_Home"
        If browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_HomePage").Link("lnk_Welcome").Exist(25)  Then
          vWin = "myCIGNA_Home"
          Exit for
        End If
      Case "myCIGNA_DenSummary"
        texist = browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").Link("lnk_Dental").Exist(4)
        tselected = browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").Link("lnk_Dental").GetROProperty("class")
        
        If texist = "True" and  tselected = "selected" Then
          texist1 = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DenCostTracker_Sum1").WebList("lst_CostTrackerSelect").Exist
          If  texist1 = "True" Then
            vWin = "myCIGNA_DenSummary"
          else
            vWin = "myCIGNA_DenSummary1"
          end if
          Exit for
        elseif texist = "True" and  tselected = "" Then
          browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").Link("lnk_Dental").Click
          texist1 = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DenCostTracker_Sum1").WebList("lst_CostTrackerSelect").Exist
          texist2 = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DenCostTracker_Sum1").Link("lnk_View deductibles and maximums").Exist
          If  texist1 = "True" and texist2 = "True" Then
            vWin = "myCIGNA_DenSummary"
          else
            vWin = "myCIGNA_DenSummary1"
          end if
          Exit for
        elseif texist = "False" and tselected = "" then
          vWin = "myCIGNA_DenSummary_Unavailable"
          Exit for
        End If
       
       
      Case "myCIGNA_DentalMbrSummary"
        if browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DentalMbrSummary").WebTable("tbl_MbrInfo").Exist then
          vWin = "myCIGNA_DentalMbrSummary"
          Exit for
        end if
       
      
      Case "myCIGNA_DentalBenefitsDtls"
        ttblexist  =browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DenBenefitsDetails").WebTable("tbl_DenBenefits").Exist
        If ttblexist = "True" Then
          vWin = "myCIGNA_DentalBenefitsDtls"
          Exit for
          End If
       
      Case "myCIGNA_CTDetails"
        tSelectYear = Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_MedCostTracker_Details").WebList("lst_InfoFor").Exist(10)
        tCTtable = Browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_MedCostTracker_Details").WebTable("tbl_OutofPocketYTD").Exist(10)
          
        if tSelectYear = "True" and tCTtable = "True" then
          vWin = "myCIGNA_CTDetails"
          Exit for
        elseif tSelectYear = "True" and tCTtable = "False" then
          vWin = "myCIGNA_CTDetails_Error"
          Exit for
        end if
      Case ""
         
      Case Else
        
      End Select
 Next
 
 if vWin = "" then
  vWin = "UnExpected Window"
 end if
   
 f_DenCTWhichwindow = vWin


End Function
'#############################################################################################
'#   Function: f_DenClmWhichwindow
'#      
'#############################################################################################
Function f_DenClmWhichwindow (tWin1,tWin2,tWin3,tWin4)
  vWin = ""
  tarWin = Array(tWin1, tWin2, tWin3, tWin4 )
 
  for i = 0 to 3
    Select Case tarWin(i)
         Case "Consumer Portal Home"
         if Browser("Browser").Page("Consumer Portal Home").Exist(25) then
           if Browser("Browser").Page("Consumer Portal Home").WebElement("Error").Exist(20) then
             vWin = "Consumer Portal Home - Error"
             Exit for
           else
              vWin = "Consumer Portal Home"
             Exit for
           end if
         end if
       Case "myCIGNA_Home"
        If browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_HomePage").Link("lnk_Welcome").Exist(25)  Then
          vWin = "myCIGNA_Home"
          Exit for
        End If
       Case "myCIGNA_DenSummary"
         texist = browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").Link("lnk_Dental").Exist(35)
            tselected = browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").Link("lnk_Dental").GetROProperty("class")

         If texist = "True" and  tselected = "selected" Then
              texist1 = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DenCostTracker_Sum1").Link("lnk_Advanced date range search").Exist
           If  texist1 = "True" Then
             vWin = "myCIGNA_DenSummary"
           else
              vWin = "myCIGNA_DenSummary1"
           end if
           Exit for
         elseif texist = "True" and  tselected = "" Then
           browser("myCIGNA").Page("myCIGNA").Frame("myCIGNA_Summary").Link("lnk_Dental").Click
           texist1 = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DenCostTracker_Sum1").Link("lnk_Advanced date range search").Exist
           If  texist1 = "True" Then
             vWin = "myCIGNA_DenSummary"
           else
              vWin = "myCIGNA_DenSummary1"
           end if
           Exit for
         elseif texist = "False" and tselected = "" then
           vWin = "myCIGNA_DenSummary_Unavailable"
           Exit for
         End If
       Case "myCIGNA_DentalMbrSummary"
         if browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DentalMbrSummary").WebTable("tbl_MbrInfo").Exist then
           vWin = "myCIGNA_DentalMbrSummary"
           Exit for
         end if
       Case "myCIGNA_AdvancedClmSearch"
         if  browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").Exist(25) then
           tcheck1 =  browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").WebRadioGroup("rbtn_dateType").Exist(5)
           tcheck2 =  browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").Image("Img_calendar").Exist(1)
           tcheck3 =  browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").Image("Img_calendar_2").Exist(1)
           tcheck5 =  browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").WebElement("Error_Msg").Exist(0)
                                    elseif browser("myCIGNA").Page("myCIGNA_2").frame("myCIGNA_DenClaimsSummary").Exist(25) then
           tcheck4 = browser("myCIGNA").Page("myCIGNA_2").frame("myCIGNA_DenClaimsSummary").WebTable("tbl_Error").Exist(1)
         end if
         If tcheck1 = "True" and tcheck2 = "True" and tcheck3 = "True" then
          If tcheck5 = "True"  Then
              vWin = "myCIGNA_AdvancedClmSearch - Error"
           Exit for
          else
           vWin = "myCIGNA_AdvancedClmSearch"
             Exit for
          End If
                                   elseif tcheck4 = "True" then
           vWin = "myCIGNA_AdvancedClmSearch - Error1"
           Exit for
         end if
       Case "myCIGNA_ClaimSummary"
         if browser("myCIGNA").Page("myCIGNA_2").frame("myCIGNA_DenClaimsSummary").webtable("tbl_Search Result").Exist(25) then
           vWin = "myCIGNA_ClaimSummary"
           Exit for
         end if
       Case "myCIGNA_ClaimDetails"
         if browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNA_DenClaimDetails").WebTable("tbl_DetailLines").Exist(25) then
            vWin = "myCIGNA_ClaimDetails"
           Exit for
         end if 
                             Case ""
         'msgbox " i am in empty section"
       Case Else
          'msgbox " This window is not defined "
      End Select
  Next
 
  if vWin = "" then
     vWin = "UnExpected Window"
  end if
   
     f_DenClmWhichwindow = vWin
End Function

'#############################################################################################
'#   Function: f_DenSelectCalendarDate
'#      
'#############################################################################################

Function f_DenSelectCalendarDate(tcalendar, tcalendardate)

  tdate = tcalendardate
  tcal = tcalendar
  arrdate = split(tdate,"/")
  tmonth = arrdate(0)
  tmonthname = MonthName(tmonth)
  tMonYear = tmonthname &" "&arrdate(2)
 
  If tcal = 1 Then
    tdate1 = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").webedit("fromDate").GetROProperty("value")
    browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").Image("Img_calendar").Click 
  elseif tcal = 2 then
    tdate1 = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").webedit("toDate").GetROProperty("value")
    browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").Image("Img_calendar_2").Click
  End If
 
  tdate = cdate(tdate)
 
   x = datediff("d", tdate, tdate1)
   text = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").WebElement("Month Year").GetROProperty("innertext")

  tcounter = 1
 
  If tMonYear text Then
  Do
   'msgbox ttime
    if x > 0 then
    browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").WebButton("   elseif x     browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").WebButton(">").Click
   end if
          text = browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").WebElement("Month Year").GetROProperty("innertext")
   If tMonYear = text Then
    Exit do
   end if
   tcounter = tcounter + 1
  Loop Until  tcounter = 48

  End if

 tdateobj = "<_> browser("myCIGNA").Page("myCIGNA_2").Frame("myCIGNADenClmAdvSrch").WebElement(tdateobj).click
end function


登录后才可评论.