Micro Focus QTP (UFT) Forums
Getting multiple errors - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Getting multiple errors (/Thread-Getting-multiple-errors)



Getting multiple errors - aminul - 05-01-2013

I am trying to work on someone else Script. its throwing various errors for me .
I am sharing the code below and line number 486 throwing all types of error.

1. wrong argument
2. objects cannot find
3. type mismatch

please help

Code:
Function PC_CreatePLan (headerData,ctrlCount)


   Dim PlanHeaderDataCtrl()
   Dim PlanHeaderDataCount

    Print "Plan Header Data"

   For i = 0 To ctrlCount-1
    
       Print headerData(i)

   Next

' msgbox ctrlCount

   ReDim PlanHeaderDataCtrl(6)
   PlanHeaderDataCtrl(0) = "name:=ctrl_marketSegment"
   PlanHeaderDataCtrl(1) = "name:=ctrl_lob"
   PlanHeaderDataCtrl(2) = "name:=ctrl_product"
   PlanHeaderDataCtrl(3) = "name:=ctrl_planDesign"
   PlanHeaderDataCtrl(4) = "name:=ctrl_funding"
   'PlanHeaderDataCtrl(5) = "name:=ctrl_claimSystem" ' Changed as per CR183: NASCO now gets disabled, so dont need to  select it
   PlanHeaderDataCtrl(5) = "name:=ctrl_benefitPeriod"

    PlanHeaderDataCount = Ubound(PlanHeaderDataCtrl)
  
   Set PCPage = Browser("Horizon Blue Cross Blue").Page("Horizon – Plan Configurator") 'Page("Horizon – Plan Configurator")    

    If PCPage.Exist(10) Then
        Set CreateNewPlan = PCPage.Link("name:=Create New Plan", "html tag:=A")
        If  CreateNewPlan.Exist(3)Then
            CreateNewPlan.Click
            Set EffectiveDate = PCPage.WebEdit("name:=ctrl_effectiveDate", "html tag:=INPUT")
            If EffectiveDate.Exist(20) Then
                EffectiveDate.Set Date
            else
                Reporter.ReportEvent micFail, "Failed to find","Effective Date"
                ErrorCount  = ErrorCount + 1
            End If
            Set NewPlanBrowser = Browser("Horizon Blue Cross Blue").Page("Horizon – Plan Configurator")
            If NewPlanBrowser.Exist(3) Then
                Set PlanDescription = NewPlanBrowser.WebEdit("name:=ctrl_description", "html tag:=INPUT")
                If PlanDescription.Exist(3) Then
                    PlanDescription.Set "New Plan"
                else
                    Reporter.ReportEvent micFail, "Failed to find", "Plan Description Edit box"
                    ErrorCount  = ErrorCount + 1
                End If
                For i= 0TO PlanHeaderDataCount-1
                    Set PlanData = PCPage.WebList(PlanHeaderDataCtrl(i), "html tag:=SELECT")
                    wait(5)
                    If PlanData.Exist(60) Then
                        PlanData.Select  PlanHeaderDataCtrl(i)[/color]
                    else
                        Reporter.ReportEvent micFail, "Failed to find", headerData(i)
                        ErrorCount  = ErrorCount + 1
                    End If
                Next
            else
                Reporter.ReportEvent micFail, "Failed to find","Create New Plan Browser"
                ErrorCount  = ErrorCount + 1
            End If
        else
            Reporter.ReportEvent micFail, "Failed to find","Create New Plan link"
            ErrorCount  = ErrorCount + 1
        End If
    else
        Reporter.ReportEvent micFail, "Failed to find", "Hz BCB Page"
        ErrorCount  = ErrorCount + 1
    End If
    'Destroy the objects
    Set HzBCBBrowser = Nothing
    Set HzBCBPage = Nothing
    Set CreateNewPlan = Nothing
    Set NewPlanBrowser = Nothing
    Set PlanDescription = Nothing
    Set PlanData = Nothing
End Function
''****************************************



RE: Getting multiple errors - aminul - 05-01-2013

Problem at occuring when I am trying to select (PlanData.Select PlanHeaderDataCtrl(i))

I just tried using SELECT (1).. it works for me for the first item for most of the drop downlist but still getting object now find for two more . and How can I not hardcode the value here ? I want to loop through all


RE: Getting multiple errors - Saket - 05-06-2013

Sorry for my ignorance, I dint had a look on the whole script, It will help if you can please point out the line number 486 and what exactly is going on into this script.