Jump to content

IE object lost using IENavigate


Sabai
 Share

Recommended Posts

The way it works is that the browser sends a "request" to the web server for something.  The Server sends back a "response header" that tells the browser the type of content it is going to send back and how many bytes of data to expect (content-length), then sends it.  The browser reads data until it gets the expected number of bytes... if the expected number of bytes are not received, the browser will not set its readyState to complete... _IELoadWait sets a timer and loops checking the readyState until it goes to complete or until the default 5 minutes pass (when the LoadWaitTimeout message is given).  As SmOke_N said, you can look in IE.au3 at the _IELoadWait function to see how this is done.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

As point out by SmOke_N and DaleHolm, this is a browser-or-website relative problem.

The example script is hanged not after navigate to (randomly) 2-3 urls but exactly when navigate to amazon.com

In this case (Amazon.com with IE8, or maybe later (I try googling around so IE7 is not affected by this problem)), the readystate flag is stuck at 3 ('interative')

I also find a interesting flag while googling, the busy flag. It will set to true whenever the browser is stopping navigate (either by finishing navigate to the site, or by the user hit 'Stop' button).

So, you can (at-your-own-risk) add the check statement into IE.au3, like this:

Case __IEIsObjType($oObject, "browser"); Internet Explorer
    While Not (String($oObject.readyState) = "complete" Or $oObject.readyState = 4 Or $bAbort)
        ; Trap unrecoverable COM errors
        If @error Then
            $iError = @error
            If __IEComErrorUnrecoverable($iError) Then
                $iErrorStatusCode = __IEComErrorUnrecoverable($iError)
                $bAbort = True
            EndIf
            ElseIf (TimerDiff($hIELoadWaitTimer) > $iTimeout) Then
                $iErrorStatusCode = $_IESTATUS_LoadWaitTimeout
                $bAbort = True

            ; ADD THIS 3 LINES
            ElseIf ($oObject.readyState = 3 and Not($oObject.busy)) Then
                $iErrorStatusCode = -1
                $bAbort = True

            EndIf
            Sleep(100)
...

or you can, as DaleHolm suggested, use the same logic with the IE.au3 UDF then provide your own wait check with the help of the busy flag I suggest.

99 little bugs in the code

99 little bugs!

Take one down, patch it around

117 little bugs in the code!

Link to comment
Share on other sites

No problemo, I just didn't want to bloat the topic so that it would be easier and not just walls of text. Let the pros go to work if you will. ;)

Thank you both DaleHohm & SmOke_N for the explanation. :D

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...