Wednesday 13 February 2013

Script to RUN Lib Functions


            CloseAllBrowsers()

            statusflag = LaunchWebAppl("iexplore.exe","www.oooo.co.in")
            stepname = "To launch web applic"
            stepdesc =  "To launch webapplication"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = WaitForPage("CIIB","CIIB","10")
            stepname = "To wait for web applic"
            stepdesc =  "To wait for  webapplication"
            result = LogResult(stepname,stepdesc,statusflag)


            statusflag = ClickOperation("CIIB","CIIBF","webelement","Personal Loans")
            stepname = "To click on pl tab"
            stepdesc = "To click on tab"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SelectOperation("CIIB","CIIBF","Frame","weblist","typeofemp","Self Employed")
            stepname = "To select type of employee"
            stepdesc = "To select type of employee"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SetOperation("CIIB","CIIBF","Frame","webedit","LoanAmount","200000")
            stepname = "To set loanamount"
            stepdesc = "To set loanamount"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SetOperation("CIIB","CIIBF","Frame","webedit","Name","chandu")
            stepname = "To set Name in textbox"
            stepdesc = "To set Name in textbox"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SelectOperation("CIIB","CIIBF","Frame","webradiogroup","Gender","1")
            stepname = "To select M/F"
            stepdesc = "To select M/F"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SelectOperation("CIIB","CIIBF","Frame","weblist","dd","5")
            stepname = "To select day"
            stepdesc = "To select day from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SelectOperation("CIIB","CIIBF","Frame","weblist","mm","February")
            stepname = "To select  month"
            stepdesc = "To select month from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SelectOperation("CIIB","CIIBF","Frame","weblist","yy","1988")
            stepname = "To select year"
            stepdesc = "To select year from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SetOperation("CIIB","CIIBF","Frame","webedit","Email","way4testing@gmail.com")
            stepname = "To set Email in textbox"
            stepdesc = "To set Email in textbox"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SelectOperation("CIIB","CIIBF","Frame","weblist","Residence","Pune")
            stepname = "To select city of residence"
            stepdesc = "To select city of residence from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SetOperation("CIIB","CIIBF","Frame","webedit","Mobile","9848022338")
            stepname = "To set Mobile in textbox"
            stepdesc = "To set Mobile in textbox"
            result = LogResult(stepname,stepdesc,statusflag)

           


'Browser("CIIB").Page("CIIBF").WebElement("Personal Loans").Click

'            statusflag = Verification("CIIB","CIIBF","webelement","Personal Loans")
'            stepname = "To click on pl tab"
'            stepdesc = "To click on tab"
'            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","weblist","typeofemp","Self Employed")
            stepname = "V To select type of employee"
            stepdesc = "V To select type of employee"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","webedit","LoanAmount","200000")
            stepname = "V To set loanamount"
            stepdesc = "V To set loanamount"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","webedit","Name","chandu")
            stepname = "V To set Name in textbox"
            stepdesc = "V To set Name in textbox"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","webradiogroup","Gender","1")
            stepname = "V To select M/F"
            stepdesc = "V To select M/F"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","weblist","dd","5")
            stepname = "V To select day"
            stepdesc = "V To select day from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","weblist","mm","February")
            stepname = "V To select  month"
            stepdesc = "V To select month from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","weblist","yy","1988")
            stepname = "V To select year"
            stepdesc = "V To select year from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","webedit","Email","way4testing@gmail.com")
            stepname = "To set Email in textbox"
            stepdesc = "To set Email in textbox"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","weblist","Residence","Pune")
            stepname = "V To select city of residence"
            stepdesc = "V To select city of residence from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","webedit","Mobile","9848022338")
            stepname = "V To set Mobile in textbox"
            stepdesc = "V To set Mobile in textbox"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = ClickOperation1("CIIB","CIIBF","Frame","image","Submit")
            stepname = "To click on submit button"
            stepdesc = "To click on submit button to navigate next page"
            result = LogResult(stepname,stepdesc,statusflag)

Library Functions


        Function CloseAllBrowsers()
                 While browser("creationtime:=0").Exist
                           browser("creationtime:=0").Close
                Wend
        End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
        Function LaunchWebAppl(broption,url)
                On error resume next
                 broption = trim(broption)
                url = trim(url)
                arrayofval = array(broption,url)
                blankspaces = CheckSpaces(arrayofval)
                If  blankspaces <> 0 Then
                    LaunchWebAppl = "invalid input given"
                Exit function
                End If
                If err.number <> 0 Then
                LaunchWebAppl = err.number&space(2)&err.description
                err.clear
                Exit function
                End If
                systemutil.Run broption,url
                LaunchWebAppl = "pass"
        End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

        Function  CheckSpaces(arrayofval)
           counter = 0
           sindex = lbound(arrayofval)
           eindex = ubound(arrayofval)
           For range = sindex to eindex
                  rangeval = arrayofval(range)
                  If  rangeval = "" Then
                      counter = counter +1
                  End If
                      CheckSpaces = counter
          Next
          End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

          Function LogResult(stepname,stepdesc,statusflag)
             If  statusflag = "pass" Then
                 reporter.ReportEvent micPass,stepname,stepdesc
             else
                   reporter.ReportEvent micFail,stepname,stepdesc&statusflag
             End If
          End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Function WaitForPage(brname,pgname,wtime)
               On error resume next

                brname = trim(brname)
                pgname = trim(pgname)
                wtime = trim(wtime)
                action = false
                sindex = 0
                eindex = wtime
                arrayofval = array(brname,pgname,wtime)
                    blankspaces = CheckSpaces(arrayofval)
                    If  blankspaces <> 0 Then
                        WaitForPage = "invalid input given"
                    Exit function
                    End If
                    If err.number <> 0  Then
                        WaitForPage = err.number&vbtab&err.description
                        err.clear
                    Exit function
                    End If
                    For index = sindex to eindex
                           pageexist = browser(brname).page(pgname).Exist
                           If  pageexist Then
                               action = true
                           End If
                    Next
                    If action Then
                        WaitForPage = "pass"
                    else
                        WaitForPage = "page is not appearing with the time range"&wtime&"seconds"
                    End If
            End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Function ClickOperation(brname,pgname,objtype,objname)
                    On error resume next
                    brname = trim(brname)
                    pgname = trim(pgname)
                    objtype = trim(objtype)
                    objname = trim(objname)
                    action = false
                    arrayofval = array(brname,pgname,objtype,objname)
                    blankspaces = CheckSpaces(arrayofval)
                    If  blankspaces <> 0 Then
                        ClickOperation = "invalid input given"
                    Exit function
                    End If
                    If err.number <> 0  Then
                        ClickOperation = err.number&vbtab&err.description
                        err.clear
                    Exit function
                    End If
                    If  objtype = "webelement" Then
                        browser(brname).page(pgname).webelement(objname).Click
                        action = true
                    End If
                    If objtype = "image" Then
                        browser(brname).page(pgname).image(objname).Click
                        action = true
                    End If
                    If action Then
                        ClickOperation = "pass"
                    else
                        ClickOperation = "Given input objtype not supported"& objtype
                    End If
            End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Function SelectOperation(brname,pgname,fname,objtype,objname,val)
                    On error resume next
                    brname = trim(brname)
                    pgname = trim(pgname)
                    fname = trim(fname)
                    objtype =  trim(objtype)
                    objname = trim(objname)
                    val = trim(val)
                    action = false
                    arrayofval = array(brname,pgname,fname,objtype,objname,val)
                    blankspaces = CheckSpaces(arrayofval)
                    If  blankspaces <> 0 Then
                        SelectOperation = "invalid input given"
                    Exit function
                    End If
                   
                    If  objtype = "weblist" Then
                        allitems = browser(brname).page(pgname).frame(fname).weblist(objname).GetROProperty("all items")
                        strloc = instr(allitems,val)
                        If strloc <> 0  Then
                            browser(brname).page(pgname).frame(fname).weblist(objname).Select val
                            action = true
                        End If
                    End If

                    If objtype = "webradiogroup" Then
                            browser(brname).page(pgname).frame(fname).webradiogroup(objname).Select val
                            action = true
                    End If

                    If action  Then
                            SelectOperation = "pass"
                    else
                            SelectOperation = "Given input objtype not supported"&objtype
                    End If

                    If err.number <> 0  Then
                        SelectOperation = err.number&vbtab&err.description
                        err.clear
                    Exit function
                    End If
            End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Function SetOperation(brname,pgname,fname,objtype,objname,val)
                    On error resume next
                     brname = trim(brname)
                    pgname = trim(pgname)
                    fname = trim(fname)
                    objtype = trim(objtype)
                    objname = trim(objname)
                    val = trim(val)
                    action = false
                    arrayofval = array(brname,pgname,fname,objtype,objname,val)
                    blankspaces = CheckSpaces(arrayofval)
                    If  blankspaces <> 0 Then
                        SetOperation = "invalid input given"
                    Exit function
                    End If
                    If err.number <> 0  Then
                        SetOperation = err.number&vbtab&err.description
                        err.clear
                    Exit function
                    End If
                    If  objtype = "webedit" Then
                        browser(brname).page(pgname).frame(fname).webedit(objname).Set val
                        action = true
                    End If
                    If action Then
                            SetOperation = "pass"
                    else
                            SetOperation = "Given objtype not supported"& objtype
                    End If
            End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Function Verification(brname,pgname,fname,objtype,objname,expval)
                        On error resume next
                        brname = trim(brname)
                        pgname = trim(pgname)
                        fname = trim(fname)
                        objtype = trim(objtype)
                        objname = trim(objname)
                        expval = trim(expval)
                        action = false
                    arrayofval = array(brname,pgname,fname,objtype,objname,expval)
                    blankspaces = CheckSpaces(arrayofval)
                    If  blankspaces <> 0 Then
                        verification = "invalid input given"
                    Exit function
                    End If
                    If err.number <> 0  Then
                        Verification = err.number&vbtab&err.description
                        err.clear
                    Exit function
                    End If
                    If  objtype = "weblist" Then
                        actval = browser(brname).page(pgname).frame(fname).weblist(objname).GetROProperty("value")
                        If actval = expval Then
                            action = true
                       
                        End If
                    End If

                    If  objtype = "webedit" Then
                        actval = browser(brname).page(pgname).frame(fname).webedit(objname).GetROProperty("value")
                        If actval = expval Then
                            action = true
                       
                        End If
                    End If

                    If  objtype = "webradiogroup" Then
                        actval = browser(brname).page(pgname).frame(fname).webradiogroup(objname).GetROProperty("value")
                        If actval = expval Then
                            action = true
                       
                        End If
                    End If

                    If action Then
                            Verification = "pass"
                    else
                            Verification = "Actval Expval not matched"
                    End If
            End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

            Function ClickOperation1(brname,pgname,fname,objtype,objname)
                    On error resume next
                    brname = trim(brname)
                    pgname = trim(pgname)
                    objtype = trim(objtype)
                    objname = trim(objname)
                    fname = trim(fname)
                    action = false
                    arrayofval = array(brname,pgname,fname,objtype,objname)
                    blankspaces = CheckSpaces(arrayofval)
                    If  blankspaces <> 0 Then
                        ClickOperation = "invalid input given"
                    Exit function
                    End If
                    If err.number <> 0  Then
                        ClickOperation = err.number&vbtab&err.description
                        err.clear
                    Exit function
                    End If
                    If  objtype = "webelement" Then
                        browser(brname).page(pgname).webelement(objname).Click
                        action = true
                    End If
                    If objtype = "image" Then
                        browser(brname).page(pgname).image(objname).Click
                        action = true
                    End If
                    If action Then
                        ClickOperation1 = "pass"
                    else
                        ClickOperation1 = "Given input objtype not supported"& objtype
                    End If
            End Function

************************************************************************************




''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Function launchwebapp(broption,url)                                                                                                            'LaunchWebApplication
                    On Error Resume Next
                    broption=trim(broption)
                    url=trim(url)
                    If  broption="" or url="" Then
                        launchwebapp="invalid input given"
                        'SystemUtil.Run "iexplore.exe","www.google.com"
                    else
                        SystemUtil.Run "iexplore.exe","www.policymagic.co.in"
                        launchwebapp="pass"
                    End If
                       
            End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Function logResult(stepName,stepDesc,stepFlag)                                                                                        'LogResult
                         If  stepFlag = "pass" Then
                            reporter.ReportEvent micPass,stepName,stepdesc
                        else
                            reporter.ReportEvent micFail,stepName,stepDesc&stepFlag
                        End If
            End Function

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Function contextWrapper(arrayofelements)                                                                                                'Context Wrapper
               startIndex = Lbound(arrayofelements)
               endIndex = Ubound(arrayofelements)
               For index = startIndex to endIndex
                   arrayval = arrayofelements(index)
                   If  arrayval="" Then
                       counter = counter +1
                   End If
               Next
                        contextWrapper = counter
            End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Function validip(bname,pname,objtype,objname,expval)
                On error resume next
                If objtype="weblist" Then
                    actval=browser(bname).page(pname).weblist(objname).GetROProperty("value")
                End If
                    If expval=actval and  strcomp(expval,actval,1)=0 Then                          'comparing actval and expval
'                                    scmp=strcomp(expval,actval,1)
'                                    If  scmp=0 Then
                                            validip="pass"
                                    else
                                            validip="fail"
    '                                End If
                                   
                    End If
'                               If err.number<>0 Then
'                                    validip=err.number&vbtab&err.description
'                                    err.clear
'                               End If

                    If  objtype="webedit" Then
                        actval=browser(bname).page(pname).webedit(objname).GetROProperty("value")
                    End If
                        If expval=actval and strcomp(expval,actval,1)=0 Then
                                        validip="pass"
                        else
                                        validip="fail"
                        End If
                        If err.number<>0 Then
                            validip=err.number&vbtab&err.description
                            err.clear
                        End If
                        Exit function
                        validip="pass"
                        End Function
                   
                    Function logResult(stepName,stepDesc,statusFlag)
                                If  statusFlag = "pass" Then
                                    Reporter.ReportEvent micPass,stepName,stepDesc
                                else
                                    Reporter.ReportEvent micFail,stepName,stepDesc
                                End If
                    End Function

                   

'                    statusFlag=validip("CII","CII","weblist","w1","20 Lacs")
'                    stepName="How much insurance do you want?"
'                    stepDesc="to compare actual and  exp value"
'                    result=logResult(stepName,stepDesc,statusFlag)
'
'                    statusFlag=validip("CII","CII","weblist","dd","5")
'                    stepName="Date Of Birth DD"
'                    stepDesc="to compare actual and  exp value"
'                    result=logResult(stepName,stepDesc,statusFlag)
'
'                    statusFlag=validip("CII","CII","webedit","name","ChAnDu")
'                    stepName="Enter Name TextBox"
'                    stepDesc="to compare actual and  exp value"
'                    result=logResult(stepName,stepDesc,statusFlag)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
            Function selectOperation(brn,pgn,objtype,objname,val)                                                                            'Select Operation
                        On error resume next
                        brn = trim(brn)
                        pgn = trim(pgn)
                        objtype = trim(objtype)
                        objname = trim(objname)
                        val = trim(val)
                        arrayofelements = array(brn,objtype,objname,val)
                        nooferrors = contextWrapper(arrayofelements)
                        If  nooferrors>0 Then
                            selectOperation = "invalid I/P's given"
                        Exit function
                        End If
                        If  objtype = "weblist" Then
                            verifyflag = browser(brn).page(pgn).weblist(objname).Exist
                            If  verifyflag Then
                                allitems = browser(brn).page(pgn).weblist(objname).GetROProperty("all items")
                                strlocation = instr(allitems,val)
                                If  strlocation > 0 Then
                                    browser(brn).page(pgn).weblist(objname).Select val
                                else
                                    selectOperation = "Item"&vbtab&val&vbtab&"is not found in list"
                           Exit Function
                                End If
                             End If
                                else
                                    selectOperation = "The objtype "&vbtab&objtype&"is not found in page"
                        End If
                                If err.number>0 Then
                                    selectOperation = err.number&err.description
                                    err.clear
                                 Exit function
                                End If
                                     selectOperation = "pass"
            End Function


           
           

Saturday 9 February 2013

How to call Functions in Script

CloseAllBrowsers()

            statusflag = LaunchWebAppl("iexplore.exe","www.abcdefgh.co.in")
            stepname = "To launch web applic"
            stepdesc =  "To launch webapplication"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = WaitForPage("CIIB","CIIB","10")
            stepname = "To wait for web applic"
            stepdesc =  "To wait for  webapplication"
            result = LogResult(stepname,stepdesc,statusflag)


            statusflag = ClickOperation("CIIB","CIIBF","webelement","Personal Loans")
            stepname = "To click on pl tab"
            stepdesc = "To click on tab"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SelectOperation("CIIB","CIIBF","Frame","weblist","typeofemp","Self Employed")
            stepname = "To select type of employee"
            stepdesc = "To select type of employee"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SetOperation("CIIB","CIIBF","Frame","webedit","LoanAmount","200000")
            stepname = "To set loanamount"
            stepdesc = "To set loanamount"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SetOperation("CIIB","CIIBF","Frame","webedit","Name","chandu")
            stepname = "To set Name in textbox"
            stepdesc = "To set Name in textbox"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SelectOperation("CIIB","CIIBF","Frame","webradiogroup","Gender","1")
            stepname = "To select M/F"
            stepdesc = "To select M/F"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SelectOperation("CIIB","CIIBF","Frame","weblist","dd","5")
            stepname = "To select day"
            stepdesc = "To select day from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SelectOperation("CIIB","CIIBF","Frame","weblist","mm","February")
            stepname = "To select  month"
            stepdesc = "To select month from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SelectOperation("CIIB","CIIBF","Frame","weblist","yy","1988")
            stepname = "To select year"
            stepdesc = "To select year from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SetOperation("CIIB","CIIBF","Frame","webedit","Email","chandu@gmail.com")
            stepname = "To set Email in textbox"
            stepdesc = "To set Email in textbox"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SelectOperation("CIIB","CIIBF","Frame","weblist","Residence","Pune")
            stepname = "To select city of residence"
            stepdesc = "To select city of residence from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = SetOperation("CIIB","CIIBF","Frame","webedit","Mobile","9848022338")
            stepname = "To set Mobile in textbox"
            stepdesc = "To set Mobile in textbox"
            result = LogResult(stepname,stepdesc,statusflag)

           


'Browser("CIIB").Page("CIIBF").WebElement("Personal Loans").Click

'            statusflag = Verification("CIIB","CIIBF","webelement","Personal Loans")
'            stepname = "To click on pl tab"
'            stepdesc = "To click on tab"
'            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","weblist","typeofemp","Self Employed")
            stepname = "V To select type of employee"
            stepdesc = "V To select type of employee"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","webedit","LoanAmount","200000")
            stepname = "V To set loanamount"
            stepdesc = "V To set loanamount"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","webedit","Name","chandu")
            stepname = "V To set Name in textbox"
            stepdesc = "V To set Name in textbox"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","webradiogroup","Gender","1")
            stepname = "V To select M/F"
            stepdesc = "V To select M/F"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","weblist","dd","5")
            stepname = "V To select day"
            stepdesc = "V To select day from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","weblist","mm","February")
            stepname = "V To select  month"
            stepdesc = "V To select month from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","weblist","yy","1988")
            stepname = "V To select year"
            stepdesc = "V To select year from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","webedit","Email","chandu@gmail.com")
            stepname = "To set Email in textbox"
            stepdesc = "To set Email in textbox"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","weblist","Residence","Pune")
            stepname = "V To select city of residence"
            stepdesc = "V To select city of residence from list"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = Verification("CIIB","CIIBF","Frame","webedit","Mobile","9848022338")
            stepname = "V To set Mobile in textbox"
            stepdesc = "V To set Mobile in textbox"
            result = LogResult(stepname,stepdesc,statusflag)

            statusflag = ClickOperation1("CIIB","CIIBF","Frame","image","Submit")
            stepname = "To click on submit button"
            stepdesc = "To click on submit button to navigate next page"
            result = LogResult(stepname,stepdesc,statusflag)

To Create an Excel Sheet

'TO  CREATE AN EXCELSHEET

'Set  xl = createobject("Excel.Application")
'        xl.Visible = true
'        xl.Workbooks.Add
'        xl.Cells(5,3).value = " automation"
'        xl.Cells(5,3).font.size = 13
'        xl.Cells(5,3).Font.ColorIndex = 25
'        xl.Cells(5,3).Font.Bold=true
'
'        xl.ActiveWorkbook.SaveAs("D:\qtp\test.xls")
'
'        xl.Quit
'
'        Set xl = Nothing



'To read input data from excelsheet
'
'   Set excel = createobject("Excel.application")
'
'   Set wbook = excel.Workbooks.Open("D:\qtp\test.xls")
'
'
'   Set wsheet = wbook.Worksheets("Sheet2")
'
'
'    rcount = wsheet.usedrange.rows.count
'    ccount = wsheet.usedrange.columns.count
'
'For row = 2 to rcount
'
'    userName = wsheet.cells(row,"A")
''    msgbox userName
'    passwd      = wsheet.cells(row,"B")
''    msgbox passwd
'    Dialog("Login").WinEdit("Agent Name:").Set userName
'    Dialog("Login").WinEdit("Password:").Set passwd
'
'Next
'
'
'user = Wsheet.cells(3,5).value
'


' compare two excel sheets

   flag = true

   Set excel = createobject("Excel.application")

   Set wbook = excel.Workbooks.Open("D:\qtp\test.xls")
   Set wsheet = wbook.Worksheets("Sheet1")


    Set wbook1 = excel.Workbooks.Open("D:\qtp\test1.xls")
   Set wsheet1 = wbook1.Worksheets("Sheet1")


   For each cell in wsheet.usedrange

'        msgbox cell.value
'        msgbox wsheet1.range(cell.address)
       If cell.value = wsheet1.Range(cell.address) Then
       
      else
             flag = false
             Exit for
       End If

   Next


   If flag = true  Then
       msgbox " both are same "
  else
       msgbox " both are different"
   End If

Excel & PowerPoint



1. Navigating in Worksheets and Selecting Cells

ctrl+shift++
Insert a new row or column (after the current row is selected with shift+space, or column is selected with ctrl+space
arrow left, arrow right, arrow up, arrow down
Move one cell up, down, left, or right in a worksheet.
ctrl + arrow keys
Moves to the edge of the current data region
shift + arrow keys
Extends the selection of cells by one cell.
ctrl+shift+arrow keys
Extends the selection of cells to the last nonblank cell in the same column or row as the active cell, or if the next cell is blank, extends the selection to the next nonblank cell
Backspace
Deletes one character to the left in the Formula Bar. Also clears the content of the active cell. In cell editing mode, it deletes the character to the left of the insertion point
Delete
Removes the cell contents (data and formulas) from selected cells without affecting cell formats or comments. In cell editing mode, it deletes the character to the right of the insertion point.
End
Moves to the cell in the lower-right corner of the window when SCROLL LOCK is turned on. Also selects the last command on the menu when a menu or submenu is visible.
ctrl+end
Moves to the last cell on a worksheet, in the lowest used row of the rightmost used column. If the cursor is in the formula bar, CTRL+END moves the cursor to the end of the text
ctrl+shift+end in worksheet
Extends the selection of cells to the last used cell on the worksheet (lower-right corner).
ctrl+shift+end in formula bar
Selects all text in the formula bar from the cursor position to the end—this does not affect the height of the formula bar.
Enter
Completes a cell entry and selects the cell below
shift+enter
Completes a cell entry and selects the cell above.
ctrl+enter
Completes a cell entry and stays in the same cell
alt+enter
Starts a new line in the same cell
Esc
Cancels an entry in the cell or Formula Bar. Closes an open menu or submenu, dialog box, or message window. It also closes full screen mode when this mode has been applied, and returns to normal screen mode to display the Ribbon and status bar again.
Home
Moves to the beginning of a row in a worksheet. Moves to the cell in the upper-left corner of the window when scroll lock is turned on. Selects the first command on the menu when a menu or submenu is visible.
ctrl+home
Moves to the beginning of a worksheet.
ctrl+shift+home
Extends the selection of cells to the beginning of the worksheet
page down
Moves one screen down in a worksheet.
alt+page down
Moves one screen to the right in a worksheet.
ctrl+page down
Moves to the next sheet in a workbook.
ctrl+shift+page down
Selects the current and next sheet in a workbook
page up
Moves one screen up in a worksheet.
alt+page up
Moves one screen to the left in a worksheet.
ctrl+page up
Moves to the previous sheet in a workbook.
ctrl+shift+page up
Selects the current and previous sheet in a workbook
Spacebar
In a dialog box, performs the action for the selected button, or selects or clears a check box.
ctrl+spacebar
Selects an entire column in a worksheet.
shift+spacebar
Selects an entire row in a worksheet.
ctrl+shift+spacebar
Selects the entire worksheet.
Tab
Moves one cell to the right in a worksheet. Moves between unlocked cells in a protected worksheet. Moves to the next option or option group in a dialog box.
shift+tab
Moves to the previous cell in a worksheet or the previous option in a dialog box.
ctrl+tab
Switches to the next tab in dialog box
ctrl+shift+tab
Switches to the previous tab in a dialog box.

2. Format Cells

ctrl+1
Format cells dialog.
ctrl+b (or ctrl+2)
Apply or remove bold formatting.
ctrl+i (or ctrl+3)
Apply or remove italic formatting.
ctrl+u (or ctrl+4)
Apply or remove an underline.
ctrl+5
Apply or remove strikethrough formatting.
ctrl+shift+&
Apply the outline border.
ctrl+shift+_ (underscore)
Remove outline borders.
ctrl+shift+f
Display the Format Cells with Fonts Tab active. Press tab 3x to get to font-size. Used to be ctrl+shift+p, but that seems just get to the Font Tab in 2010.
alt+' (apostrophe / single quote)
Display the Style dialog box.
3. Function keys in Excel 2007
f1
Displays the Microsoft Office Excel Help task pane.
ctrl+f1
Displays or hides the Ribbon, a component of the Microsoft Office Fluent user interface.
alt+f1
Creates a chart of the data in the current range.
alt+shift+f1
Inserts a new worksheet.
f2
Edits the active cell and positions the insertion point at the end of the cell contents. It also moves the insertion point into the Formula Bar when editing in a cell is turned off.
shift+f2
Adds or edits a cell comment.
ctrl+f2
Displays the Print Preview window.
f3
Displays the Paste Name dialog box.
ctrl+f3
Display the Name Manager, create new names.
shift+f3
Displays the Insert Function dialog box.
f4
Repeats the last command or action, if possible.
ctrl+f4
Closes the selected workbook window.
f5
Displays the Go To dialog box.
ctrl+f5
Restores the window size of the selected workbook window.
f6
Switches between the worksheet, Ribbon, task pane, and Zoom controls. In a worksheet that has been split (View menu, Manage This Window, Freeze Panes, Split Window command), F6 includes the split panes when switching between panes and the Ribbon area.
shift+f6
Switches between the worksheet, Zoom controls, task pane, and Ribbon.
ctrl+f6
Switches to the next workbook window when more than one workbook window is open.
f7
Displays the Spelling dialog box to check spelling in the active worksheet or selected range.
ctrl+f7
Performs the Move command on the workbook window when it is not maximized. Use the arrow keys to move the window, and when finished press ENTER, or ESC to cancel.
f8
Turns extend mode on or off. In extend mode, Extended Selection appears in the status line, and the arrow keys extend the selection.
shift+f8
Enables you to add a nonadjacent cell or range to a selection of cells by using the arrow keys.
ctrl+f8
Performs the Size command (on the Control menu for the workbook window) when a workbook is not maximized.
alt+f8
Displays the Macro dialog box to create, run, edit, or delete a macro.
f9
Calculates all worksheets in all open workbooks.
shift+f9
Calculates the active worksheet.
ctrl+alt+f9
calculates all worksheets in all open workbooks, regardless of whether they have changed since the last calculation.
ctrl+alt+shift+f9
Rechecks dependent formulas, and then calculates all cells in all open workbooks, including cells not marked as needing to be calculated.
ctrl+f9
Minimizes a workbook window to an icon.
f10
Turns key tips on or off.
shift+f10
Displays the shortcut menu for a selected item.
alt+shift+f10
Displays the menu or message for a smart tag. If more than one smart tag is present, it switches to the next smart tag and displays its menu or message.
ctrl+f10
Maximizes or restores the selected workbook window.
f11
Creates a chart of the data in the current range.
shift+f11
Inserts a new worksheet.
alt+f11
Opens the Microsoft Visual Basic Editor, in which you can create a macro by using Visual Basic for Applications (VBA).
f12
Displays the Save As dialog box.

   
                      4. CTRL Combinations in Excel 2007

ctrl+shift+(
Unhides any hidden rows within the selection.
ctrl+shift+)
Unhides any hidden columns within the selection.
ctrl+shift+&
Applies the outline border to the selected cells.
ctrl+shift+_
Removes the outline border from the selected cells.
ctrl+shift+~
Applies the General number format.
ctrl+shift+$
Applies the Currency format with two decimal places (negative numbers in parentheses).
ctrl+shift+%
Applies the Percentage format with no decimal places.
ctrl+shift+^
Applies the Exponential number format with two decimal places.
ctrl+shift+#
Applies the Date format with the day, month, and year.
ctrl+shift+@
Applies the Time format with the hour and minute, and AM or PM.
ctrl+shift+!
Applies the Number format with two decimal places, thousands separator, and minus sign (-) for negative values.
ctrl+shift+*
Selects the current region around the active cell (the data area enclosed by blank rows and blank columns). In a PivotTable, it selects the entire PivotTable report.
ctrl+shift+:
Enters the current time.
ctrl+shift+"
Copies the value from the cell above the active cell into the cell or the Formula Bar.
ctrl+shift++
Displays the Insert dialog box to insert blank cells.
ctrl+-
Displays the Delete dialog box to delete the selected cells.
ctrl+;
Enters the current date.
ctrl+`
Alternates between displaying cell values and displaying formulas in the worksheet.
ctrl+'
Copies a formula from the cell above the active cell into the cell or the Formula Bar.
ctrl+1
Displays the Format Cells dialog box.
ctrl+2
Applies or removes bold formatting.
ctrl+3
Applies or removes italic formatting.
ctrl+4
Applies or removes underlining.
ctrl+5
Applies or removes strikethrough.
ctrl+6
Alternates between hiding objects, displaying objects, and displaying placeholders for objects.
ctrl+8
Displays or hides the outline symbols.
ctrl+9
Hides the selected rows.
ctrl+0
Hides the selected columns.
ctrl+a
Selects the entire worksheet. If the worksheet contains data, CTRL+A selects the current region. Pressing CTRL+A a second time selects the current region and its summary rows. Pressing CTRL+A a third time selects the entire worksheet.
ctrl+shift+a
Inserts the argument names and parentheses when the insertion point is to the right of a function name in a formula.
ctrl+b
Applies or removes bold formatting.
ctrl+c
Copies the selected cells.
ctrl+c
Followed by another CTRL+C displays the Clipboard.
ctrl+d
Uses the Fill Down command to copy the contents and format of the topmost cell of a selected range into the cells below.
ctrl+f
Displays the Find and Replace dialog box, with the Find tab selected.
ctrl+shift+f
Opens the Format Cells dialog box with the Font tab selected.
ctrl+g
Displays the Go To dialog box.
ctrl+h
Displays the Find and Replace dialog box, with the Replace tab selected.
ctrl+i
Applies or removes italic formatting.
ctrl+k
Displays the Insert Hyperlink dialog box for new hyperlinks or the Edit Hyperlink dialog box for selected existing hyperlinks.
ctrl+n
Creates a new, blank workbook.
ctrl+o
Displays the Open dialog box to open or find a file.
ctrl+shift+o
Selects all cells that contain comments.
ctrl+p
Displays the Print dialog box.
ctrl+shift+p
Opens the Format Cells dialog box with the Font tab selected.
ctrl+r
Uses the Fill Right command to copy the contents and format of the leftmost cell of a selected range into the cells to the right.
ctrl+s
Saves the active file with its current file name, location, and file format.
ctrl+t
Displays the Create Table dialog box.
ctrl+u
Applies or removes underlining.
ctrl+shift+u
Switches between expanding and collapsing of the formula bar.
ctrl+v
Inserts the contents of the Clipboard at the insertion point and replaces any selection. Available only after you have cut or copied an object, text, or cell contents.
ctrl+alt+v
Displays the Paste Special dialog box. Available only after you have cut or copied an object, text, or cell contents on a worksheet or in another program.
ctrl+w
Closes the selected workbook window.
ctrl+x
Cuts the selected cells.
ctrl+y
Repeats the last command or action, if possible.
ctrl+z
Uses the Undo command to reverse the last command or to delete the last entry that you typed.
ctrl+shift+z
Uses the Undo or Redo command to reverse or restore the last automatic correction when AutoCorrect Smart Tags are displayed

                                                      PowerPoint 2007 Shortcuts

f5
Start the presentation from the beginning.
n, enter, page down, arrow right, arrow down,rspacebar
Perform the next animation or advance to the next slide.
p, page up, arrow left, arrow up, or backspace
Perform the previous animation or return to the previous slide.
number+enter
Go to slide number.
b or .
Display a blank black slide, or return to the presentation from a blank black slide.
w or ,
Display a blank white slide, or return to the presentation from a blank white slide.
s
Stop or restart an automatic presentation.
esc or -
End a presentation.
e
Erase on-screen annotations.
h
Go to the next slide, if the next slide is hidden.
t
Set new timings while rehearsing.
o
Use original timings while rehearsing.
m
Use a mouse click to advance while rehearsing.
1+enter
Return to the first slide.
ctrl+p
Redisplay hidden pointer or change the pointer to a pen.
ctrl+a
Redisplay hidden pointer or change the pointer to an arrow.
ctrl+h
Hide the pointer and navigation button immediately.
ctrl+u
Hide the pointer and navigation button in 15 seconds.
shift+f10
Display the shortcut menu.
tab
Go to the first or next hyperlink on a slide.
shift+tab
Go to the last or previous hyperlink on a slide.
enter while a hyperlink is selected
Perform the "mouse click" behavior of the selected hyperlink.
shift+f5
Start the presentation from the slide you are currently on.



1. Work with Text and Objects

alt+shift+arrow left
Promote a paragraph.
alt+shift+arrow right
Demote a paragraph.
alt+shift+arrow up
Move selected paragraphs up.
alt+shift+arrow down
Move selected paragraphs down.
alt+shift+1
Show heading level 1.
alt+shift++
Expand text below a heading.
alt+shift+-
Collapse text below a heading.
shift+arrow right
Select one character to the right.
shift+arrow left
Select one character to the left.
ctrl+shift+arrow right
Select to the end of a word.
ctrl+shift+arrow left
Select to the beginning of a word.
shift+arrow up
Select one line up.
shift+arrow down
Select one line down.
esc
Select an object (with text selected inside the object).
tab or shift+tab until the object you want is selected
Select an object (with an object selected).
enter
Select text within an object (with an object selected).
2. Basic Text Navigation and Formatting
ctrl+shift+f
Change the font.
ctrl+shift+p
Change the font size.
ctrl+shift+;
Increase the font size of the selected text.
ctrl+shift+;
Decrease the font size of the selected text.
arrow left
Move one character to the left.
arrow right
Move one character to the right.
arrow up
Move one line up.
arrow down
Move one line down.
ctrl+arrow left
Move one word to the left.
ctrl+arrow right
Move one word to the right.
end
Move to the end of a line.
home
Move to the beginning of a line.
ctrl+arrow up
Move up one paragraph.
ctrl+arrow down
Move down one paragraph.
ctrl+end
Move to the end of a text box.
ctrl+home
Move to the begi

3. Change Fonts and Formatting

ctrl+shift+f
Open the Font dialog box to change the font.
ctrl+shift+p
Open the Font dialog box to change the font size.
ctrl+shift+;
Increase the font size.
ctrl+shift+;
Decrease the font size.
ctrl+t
Open the Font dialog box to change the formatting of characters.
shift+f3
Change the case of letters between sentence, lowercase, or uppercase.
ctrl+b
Apply bold formatting.
ctrl+u
Apply an underline.
ctrl+i
Apply italic formatting.
ctrl+=
Apply subscript formatting (automatic spacing).
ctrl+shift++
Apply superscript formatting (automatic spacing).
ctrl+spacebar
Remove manual character formatting, such as subscript and superscript.
ctrl+k
Insert a hyperlink.
ctrl+shift+c
Copy formats.

6. Move around in Tables

tab
Move to the next cell.
shift+tab
Move to the preceding cell.
arrow down
Move to the next row.
arrow up
Move to the preceding row.
ctrl+tab
Insert a tab in a cell.
enter
Start a new paragraph.
tab at the end of the last row
Add a new row at the bottom of the table.
alt, j, d, a, and then pP
Launch the Selection pane.
 
7. Manage Smart Tags

alt+shift+f10
Display the menu or message for a smart tag. If more than one smart tag is present, switch to the next smart tag and display its menu or message.
arrow down
Select the next item on a smart tag menu.
arrow up
Select the previous item on a smart tag menu.
enter
Perform the action for the selected item on a smart tag menu.
esc
Close the smart tag menu or message.
 
8. Microsoft Office basics applicable to PowerPoint 2007

alt+tab
Switch to the next window.
alt+shift+tab
Switch to the previous window.
ctrl+w or ctrl+f4
Close the active window.
ctrl+f5
Restore the size of the active window after you maximize it.
f6
Move a task pane from another pane in the program window (clockwise direction). You may need to press F6 more than once
shift+f6
Move to a pane from another pane in the program window (counterclockwise direction).
ctrl+f6
When more than one window is open, switch to the next window.
ctrl+shift+f6
Switch to the previous window.
ctrl+f7
When a document window is not maximized, perform the Move command (on the Control menu for the window). Use the arrow keys to move the window and when finished, press ESC.
ctrl+f8
When a document window is not maximized, perform the Size command (on the Control menu for the window). Press the arrow keys to resize the window and when finished, press ESC.
ctrl+f9
Minimize a window to an icon (works for only some Microsoft Office programs).
ctrl+f10
Maximize or restore a selected window.
print screen
Copy a picture of the screen to the Clipboard.
alt+print screen
Copy a picture of the selected window to the Clipboard.

9. Work with Dialog Boxes

tab
Move to the next option or option group.
shift+tab
Move to the previous option or option group.
ctrl+tab
Switch to the next tab in a dialog box.
ctrl+shift+tab
Switch to the previous tab in a dialog box.
alt+arrow down
Open a selected drop-down list.
First letter of an option in a drop-down list
Open the list if it is closed and move to an option in the list.
arrow keys
Move between options in an open drop-down list, or between options in a group of options.
esc
Close a selected drop-down list; cancel a command and close a dialog box.
spacebar
Perform the action assigned to the selected button; select or clear the selected check box.
alt+ the letter underlined in an option
Select an option; select or clear a check box.
enter
Perform the action assigned to a default button in a dialog box.
home
Move to the beginning of the entry.
end
Move to the end of the entry.
arrow left, arrow right
Move one character to the left or right, respectively.
ctrl+arrow left
Move one word to the left.
ctrl+arrow right
Move one word to the right.
shift+arrow left
Select or cancel selection one character to the left.
shift+arrow right
Select or cancel selection one character to the right.
ctrl+shift+arrow left
Select or cancel selection one word to the left.
ctrl+shift+arrow right
Select or cancel selection one word to the right.
shift+home
Select from the cursor to the beginning of the entry.
shift+end
Select from the cursor to the end of the entry.
shift+f10
Display the context menu.
spacebar or enter
Select a focused item.
shift+spacebar or shift+enter
Cancel selection of a focused item.
ctrl+shift+f
Move a selected item forward.
ctrl+shift+b
Move a selected item backward.
ctrl+shift+s
Show or hide a focused item.
f2
Rename a focused item.
tab or shift+tab
Switch the keyboard focus within the Selection pane between tree view and the Show All and Hide All buttons.
alt+shift+1
Collapse all groups.
alt+shift+9
Expand all groups.