Thursday, April 29, 2010

Get data from Web Page View Source Tags

Set objDictionary = CreateObject("Scripting.dictionary")
iFlag=0
Set sAllitems=Browser("CreationTime:=1").Page("title:=.*").Object.all.tags("a")
icount= sAllitems.Length
msgbox icount
For i=0 to icount-1
msgbox sAllitems(i)
If Instr(1, sAllitems(i), "http://www.google.com/ncr")<>0 Then
sitemsList=Split(sAllitems(i), "http://www.google.com/")
msgbox sitemsList(1)
sItemsName=Split(sitemsList(1), "'")
Reporter.ReportEvent micDone,"Captured value"," Captured value:- " & sitemsList(0)
sItem=sItemsName(0)
Reporter.ReportEvent micDone," Find Item :- " & sItem, sItem

If Not objDictionary.Exists(sItem) Then
objDictionary.Add sItem, iFlag
iFlag=iFlag+1
End If

End If
Next
'Code to display the Items list
iKeys = objDictionary.Keys
If objDictionary.Count<>0 Then
For sItem = 0 To objDictionary.Count - 1
If sItem=0 Then
msgbox iKeys(sItem)
Else
Msgbox iKeys(sItem)
End If
print iKeys(sItem)
Reporter.ReportEvent micDone,"Items Count:- " ," count" & sItem &" -- - -" & iKeys(sItem)
Next
Else
print "Nothing Exist"
Reporter.ReportEvent micDone,"Items are not exists"," Items are not exists in Open page"
End If
Set objDictionary = Nothing

No comments:

Post a Comment