“IUWebBrowser2"对象的“Busy"方法失败 [英] 'Busy' method of 'IUWebBrowser2' object failed

查看:32
本文介绍了“IUWebBrowser2"对象的“Busy"方法失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我通过我的代码启动网站时,在我的变量oDoc"级别出现对象 iwebbrowser2 的方法文档失败"类型的错误

When I launch the site via my code, there is an error of type "method document of object iwebbrowser2 failed " at the level of my variable "oDoc"

Private Function CreerNavigateur(ByVal mails As String)
Dim IE As Object
Dim oDoc As Object
Dim Htable, maTable As Object
Dim text As String
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = False
IE.navigate "https://csrtool-ssl.sso.infra.ftgroup/csrtool_web/Bricks/pg/osuit/pages/identity/IdentityAccountAndUsers?type=emailAlias&value=" & mails & "&tab_main=AccountInfo"
While IE.Busy Or IE.ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
    Set oDoc = IE.Document
    Set Htable = oDoc.getElementsByTagName("div")(1)
   ' MsgBox Htable.innerhtml
    Set maTable = Htable.getElementsByTagName("span")
    'MsgBox maTable(0).href
    'myData = maTable(0).innertext
    'MsgBox (myData)
    IE.Quit
    'On libère les variables
    Set IE = Nothing
    Set oDoc = Nothing
End Function

谢谢你帮助我看到我的错误

thank you for helping me to see my mistake

推荐答案

正式化我的答案尝试最大化即窗口和更新的代码将

formalizing my answer try maximized ie window and updated code will be

Private Function CreerNavigateur(ByVal mails As String)
    Dim ie As SHDocVw.InternetExplorer
    Dim oDoc As Object
    Dim Htable, maTable As Object
    Dim text As String

    Set ie = New SHDocVw.InternetExplorer
    ie.Visible = False
    ie.navigate "https://csrtool-ssl.sso.infra.ftgroup/csrtool_web/Bricks/pg/osuit/pages/identity/IdentityAccountAndUsers?type=emailAlias&value=" & mails & "&tab_main=AccountInfo"

    While ie.Busy Or ie.ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend

    Set oDoc = ie.Document
    Set Htable = oDoc.getElementsByTagName("div")(1)
    'MsgBox Htable.innerhtml
    Set maTable = Htable.getElementsByTagName("span")
    'MsgBox maTable(0).href
    'myData = maTable(0).innertext
    'MsgBox (myData)
    ie.Quit
    'On libère les variables
    Set ie = Nothing
    Set oDoc = Nothing
End Function

这篇关于“IUWebBrowser2"对象的“Busy"方法失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆