none
“Method Busy' of object 'IWebBrowser2' failed” RRS feed

  • Question

  • tried several things, and this is very frustrating. the following code works perfectly for Web applications I automated:

    Set objIE = GetIEwithURLcontaining(applicationName)
    objIE.Navigate2 "http://www.google.com"
    Call WaitForPageToLoad(objIE)

    where the wait function is:

    Public Function WaitForPageToLoad(obj As Object)
    
    Call Sleep(1000)
    While obj.Busy Or obj.Document.readyState <> "complete"
        DoEvents
    Wend
    
    End Function

    objIE object is obtained in this way

    Public Function GetIEwithURLcontaining(p As String) As Object
    
    Dim a, b As Object
    Dim q As String
    
    Set a = CreateObject("Shell.Application").Windows
    
    If a.count > 0 Then
    For Each b In a
        q = VBA.Trim(b.fullName)
        If VBA.UCase(VBA.Right(q, 12)) = "IEXPLORE.EXE" Then
            On Error GoTo Clean
            Debug.Print b.Document.url
            If InStr(b.Document.url, p) <> 0 Then GoTo Proceed    ''' this throws an error if the only IE page open has no url, like a blank tab.
        End If                                                    ''' If this happens we can't get our window so exit function
    Next
    End If
    Clean:
    Set GetIEwithURLcontaining = Nothing
    Exit Function
    Proceed:
    'AppActivate b.document.title                   'fucntion will grab the window if it exsists at all, so appactivate can throw an error if user executes from a different webpage
    Set GetIEwithURLcontaining = b
    End Function

    however, for one site I navigate it just breaks for SOME people (not for me). The error “Method Busy' of object 'IWebBrowser2' failed” or “Method Navigate2' of object 'IWebBrowser2' failed” appears.

    what am I doing wrong?



    • Edited by avalyn3 Friday, March 17, 2017 4:07 PM
    Friday, March 17, 2017 4:04 PM

All replies

  • Try clearing the cache completely.  I've had problems like this previously and clearing thee cache has helped several times.
    Saturday, March 18, 2017 10:55 PM