这不是一项重要任务,但我认为这很容易,而且非常令人沮丧。我正试图从我们的MFP中获取当前的打印计数器值,但我无法通过页面上的第二帧。
事实上,当我试图“更深入”进入页面时,它似乎不断地让我回到顶端。
我所追踪的数据存储在“内容”框架中。
HTML源代码 - 嵌套框架
Sub Copy_Count()
Dim IE As InternetExplorerMedium
Dim strURL() As String
Dim HTML_Doc As HTMLDocument
Dim HTML_Doc2 As HTMLDocument
' There will be additional machines to retrieve data from, current copier must navigate to main page first before counter.
strURL = Split("http://192.168.50.26/?MAIN=DEVICE,http://192.168.50.26/?MAIN=COUNTER&SUB=TOTAL", ",")
Set IE = New InternetExplorerMedium
IE.Navigate2 strURL(0)
Do
DoEvents
Loop Until IE.ReadyState = READYSTATE_COMPLETE
IE.Navigate2 strURL(1)
Do
DoEvents
Loop Until IE.ReadyState = READYSTATE_COMPLETE
Set HTML_Doc = IE.Document
' This get's me to "TopLevelFrame"
Debug.Print HTML_Doc.getElementsByTagName("frameset")(0).getElementsByTagName("frame")(0).Document.Body.innerHTML
' Assign the document of the TopLevelFrame
Set HTML_Doc2 = HTML_Doc.getElementsByTagName("frameset")(0).getElementsByTagName("frame")(0).Document
Debug.Print HTML_Doc2.getElementById("TotalFullColor")
Debug.Print HTML_Doc.getElementById("TotalFullColor").innerText
Debug.Print IE.Document.GetElementsByID("TotalFullColor")(1)
End Sub
Windows 10 Pro,IE 11,Office Pro Plus 2016