我想从此网页获取excel表格中的一些信息:http://www.livescore.in/
我的代码如下:
Dim page1 As MSXML2.XMLHTTP60
Dim html As MSHTML.HTMLDocument
Dim myDiv As Object
Set page1 = New MSXML2.XMLHTTP60
Set html = New MSHTML.HTMLDocument
page1.Open "GET", "http://www.livescore.in", False
page1.send
Do Until page1.readyState = 4 And page1.Status = 200
DoEvents
Loop
html.body.innerHTML = page1.responseText
Set myDiv = html.getElementById("fscon")
Debug.Print myDiv.innerText
我想在" fs"在" fscon"中的div DIV 此脚本的结果是"正在加载..."
我知道问题是什么:当基页加载时,一些javascript会填满" fscon" DIV。我的脚本只能看到基页(没有数据算法)
我的问题是如何等到整页加载?
由于
更新: 这段代码正在运行。它使用IE对象,我将测试从页面扫描所有匹配的速度。
Dim ieApp As InternetExplorer
Dim ieDoc As Object
Set ieApp = New InternetExplorer
ieApp.Visible = False
ieApp.navigate "http://www.livescore.in"
Do While ieApp.Busy: DoEvents: Loop
Do Until ieApp.readyState = READYSTATE_COMPLETE: DoEvents: Loop
Set ieDoc = ieApp.document
Debug.Print ieDoc.all.Item("fscon").innerText
Set ieDoc = Nothing
ieApp.Quit
Set ieApp = Nothing