01-17-2013, 10:51 AM
Hi All,
Finally this code worked for me. Please have a look and let me know if anyone have any suggestion to make it better.
Thanks,
Nilanjan
Finally this code worked for me. Please have a look and let me know if anyone have any suggestion to make it better.
Code:
SystemUtil.Run "C:\Documents and Settings\nilanjans\Desktop\Count Broken Images\Example\BrokenLink.html"
wait(5)
Browser("Creationtime:=0").Sync
wait(3)
Set oDesc=Description.Create()
oDesc("micclass").Value="Image"
oDesc("html tag").Value="IMG"
Set linkCollection=Browser("title:=.*").Page("title:=.*").ChildObjects(oDesc)
msgbox linkCollection.count
brokenImg=0
For i=0 to linkCollection.Count-1
nativePropertyVal = linkCollection(i).Object.sourceindex
msgbox nativePropertyVal'Use the native property in place of sourceindex
' If StrComp(nativePropertyVal,"4")=0 Then 'Compare the native property value you want to use
If linkCollection(i).Object.fileSize<=0 then
msgbox "Image Broken"
brokenImg=brokenImg+1
else
msgbox "Image loaded properly"
End if
' End If
Next
Msgbox "Broken Image Count on Page:" &brokenImg
Thanks,
Nilanjan