Using Internet Explorer objects to scrape links from web pages.
Posted by: Jerry Lees
Recently, I needed to write a tool that would scrape the links from a page. To accomplish this I used the Internet Explorer object “InternetExplorer.Application“. We’ll explain it a bit more in a later entry but for now, take a look at the code below:
URL = “http://itknowledgeexchange.techtarget.com/itblogs/“
With CreateObject(”InternetExplorer.Application”)
.Navigate URL
Do Until .ReadyState = 4
Wscript.sleep 10
Loop
for each link in .document.links
Wscript.echo link, link.InnerText
next
‘ Uncomment the three lines below to scrape references to images
‘ for each pix in .document.images
‘ Wscript.echo pix.src
‘ Next
.Quit
End With


