关于在Webbroswer中多框架页面的操作问题
程序启动后,会进入一个多框架网页,我想让程序判断所有框架中的内容是否加载完毕,加载完毕后再进行下面的操作该怎么办?BUSY对多框架无效。还没加载完就进行下面的操作了。另外多框架中的元素该怎么操作?
求大神指点,谢谢!
Private Function getFrames(ByVal WB As WebBrowser) As Object Dim pContainer As Dim pEnumerator As olelib.IEnumUnknown Dim pUnk As olelib.IUnknown Dim pBrowser As SHDocVwCtl.WebBrowser_V1 Set pContainer = WB.object.Document If pContainer.EnumObjects(OLECONTF_EMBEDDINGS, pEnumerator) = 0 Then Set pContainer = Nothing Do While pEnumerator.Next(1, pUnk) = 0 On Error Resume Next Set pBrowser = pUnk If Err.Number = 0 Then Print "Frame: " & pBrowser.LocationURL If pBrowser.LocationURL = "http://XXX.XXX.XXX/ssp/eva/self.jsp?right_no=07010003" Then Set getFrames = pBrowser Exit Function End If End If Loop Set pEnumerator = Nothing End If End Function Private Sub webbrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) Debug.Print URL If URL = "http://XXX.XXX.XXX/ssp/eva/self.jsp?right_no=07010003" Then getFrames(WebBrowser1).Document.All("self_eva_score_0").Value = "1" getFrames(WebBrowser1).Document.getElementById("savebutton").Click End If End Sub非常感谢!!
getFrames(WebBrowser1).Document.All("self_eva_score_0").Value = "1"就出现错误91,但页面已经打开了呀,不应该会是因为未载入完全而引起的吧。