Hi All,

Can we have any function with which we can validate the availability of the
any object in the page.

I have written a code (PLS CHECK ATTACHMENT), can we have the compact one...





Thanks and Regards,
Suresh Bhandari

-- 
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
ItemObjectCheck "Browser", "Page", "", "WebButton", "Sign In", False
ItemObjectCheck "Browser", "Page", "", "WebElement", "Facebook", True
ItemObjectCheck "Browser", "Page", "", "Link", "Facebook", True


Function ItemObjectCheck(oBrowser,oPage,oFrame,oComponent,oName,blnCond)
                        ItemObjectCheck = False
                        If      Browser(oBrowser).Page(oPage).Exist(Sync) Then
                                                                                
                        Select Case oComponent
                                                                                
                        Case "Image"
                                                                                
                                If Len(oFrame)>1 Then
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).Frame(oFrame).Image(oName)
                                                                                
                                Else
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).Image(oName)
                                                                                
                                End If
                                                                                
                        Case "Link"
                                                                                
                                If Len(oFrame)>1 Then
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).Frame(oFrame).Link(oName)
                                                                                
                                Else
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).Link(oName)
                                                                                
                                End If
                                                                                
                        Case "WebButton"
                                                                                
                                If Len(oFrame)>1 Then
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).Frame(oFrame).WebButton(oName)
                                                                                
                                Else
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).WebButton(oName)
                                                                                
                                End If
                                                                                
                        Case "WebEdit"
                                                                                
                                If Len(oFrame)>1 Then
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).Frame(oFrame).WebEdit(oName)
                                                                                
                                Else
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).WebEdit(oName)
                                                                                
                                End If
                                                                                
                        Case "WebElement"
                                                                                
                                If Len(oFrame)>1 Then
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).Frame(oFrame).WebElement(oName)
                                                                                
                                Else
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).WebElement(oName)
                                                                                
                                End If
                                                                                
                        Case "WebList"
                                                                                
                                If Len(oFrame)>1 Then
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).Frame(oFrame).WebList(oName)
                                                                                
                                Else
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).WebList(oName)
                                                                                
                                End If
                                                                                
                        Case "WebRadioGroup"
                                                                                
                                If Len(oFrame)>1 Then
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).Frame(oFrame).WebRadioGroup(oName)
                                                                                
                                Else
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).WebRadioGroup(oName)
                                                                                
                                End If
                                                                                
                        Case "WebTable"
                                                                                
                                If Len(oFrame)>1 Then
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).Frame(oFrame).WebTable(oName)
                                                                                
                                Else
                                                                                
                                        Set objSmt = 
Browser(oBrowser).Page(oPage).WebTable(oName)
                                                                                
                                End If
                                                                                
                        End Select
                                                If blnCond Then
                                                                                
If objSmt.Exist Then
                                                                                
        ItemObjectCheck = True
                                                                                
        Reporter.ReportEvent micPass, "Validate " & oComponent & " Should be 
present in the " & oPage & " Page",  oComponent & " is available in the " & 
oPage  & " Page"
                                                                                
Else
                                                                                
        Reporter.ReportEvent micFail, "Validate " & oComponent & " Should be 
present in the " & oPage & " Page",  oComponent & " is NOT available in the " & 
oPage  & " Page"
                                                                                
End If
                                                ElseIf Not(blnCond) Then
                                                                                
If Not(objSmt.Exist) Then
                                                                                
        ItemObjectCheck = True
                                                                                
        Reporter.ReportEvent micPass, "Validate " & oComponent & " Should NOT 
present in the " & oPage & " Page",  oComponent & " is NOT available in the " & 
oPage  & " Page"
                                                                                
Else
                                                                                
        Reporter.ReportEvent micFail, "Validate " & oComponent & " Should NOT 
present in the " & oPage & " Page",  oComponent & " is available in the " & 
oPage  & " Page"
                                                                                
End If
                                                End If
                        End If 
End Function











Reply via email to