Custom Search

Friday, May 4, 2012

Get the all Object class count in one web page


Using below code we get all the Object class count in one web page.
NOTE : It will not get the Webelements count in a page.

Set obj= description.Create
obj("class").value=".*"
set chobj=Browser("title:=Gmail: Email from Google").Page("title:=Gmail: Email from Google").ChildObjects(obj)
msgbox chobj.count
linkCount=0
editboxCount=0
checkboxCount=0
imageCount=0
listCount=0
For i=0 to chobj.count -1
                 Obj= chobj(i).tostring
                 ObjCla=Split(Obj,"] ")
                Select Case ObjCla(1)
                                Case "link"
                                                linkCount=linkCount+1
                                Case "edit box"
                                                editboxCount=editboxCount+1
                                Case "check box"
                                                checkboxCount=checkboxCount+1
                                Case "image"
                                                imageCount=imageCount+1
                                Case "list"
                                                listCount=listCount+1   
                End Select

Next

Print "No of Link in a page : " & linkCount
Print "No of editbox  in a page : " & editboxCount
Print "No of checkbox in a page : " & checkboxCount
Print "No of image in a page : " & imageCount
Print "No of listbox in a page : " & listCount

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.