tags:

views:

46

answers:

0

Is there a way to traverse all elements on an html web page by VBScript? For example, I want to get all the object information on an html web page: http://www.echoecho.com/html.htm

Here is the script I have created, thanks:

Dim objIE 
Dim IEObject
Dim Info
Info = “”

Set objIE = CreateObject("InternetExplorer.Application")
objIE.Visible = True
objIE.Navigate "http://www.echoecho.com/html.htm"

Do While objIE.Busy Or (objIE.READYSTATE <> 4)
   Wscript.Sleep 100
Loop
WScript.Sleep 50

‘ Can I use objIE.Document.all.Item.length to count all elements on the webpage?
For i=1 to objIE.Document.all.Item.length then

   IEObject = objIE.Document..??????... item (i-1)…???
   Info = Info & vbCrLf & i & IEObject.id & “-“IEObject.title & “-“ & IEObject.name & “-“ & ….etc.

Next

Wscript.Echo Info

Set IEObject = Nothing
Set objIE = Nothing