Jump to content

IE object lost using IENavigate


Sabai
 Share

Recommended Posts

I am just trying to navigate to many different websites but it appears as if the IE object is getting lost after going to anywhere from 1 to 8 sites.  The browser stops redirecting, and after few minutes I finally get the MsgBox error.  This is happening for me in Windows 7/IE 11 and Windows 8.1 IE11. 

#include <File.au3>
#include <Array.au3>
#include <IE.au3>

$sSites = "news.google.com,yahoo.com,bing.com,amazon.com,nextag.com,craigslist.org,newegg.com,shopping.com,dealtime.com,thefind.com,pricewatch.com,hautelook.com,ideeli.com,dealspl.us,dealnews.com,pronto.com,etsy.com"
$aMerchList = StringSplit(StringStripWS(StringStripCR($sSites), $STR_STRIPALL), ",")
    $cNumMerchants = UBound($aMerchList) - 1
    $oIE = _IECreate()
    If @error Then
        MsgBox(0, "Error", "There was a problem opening IE! Closing application.")
        Exit
    EndIf
    Sleep(3000)
    ; For each merchant in the file, send each URL through the browser.
    For $i = 1 To $cNumMerchants
        ; THIS IS WHERE AUTOIT LOSES THE CONNECTION TO BROWSER AFTER ~2-3 URLS
         _IENavigate($oIE, $aMerchList[$i])
        If @error Then
            MsgBox(0, "Error", "There was a problem opening webpage!")
        EndIf
    Next
    _IEQuit($oIE)
Link to comment
Share on other sites

2 issues:

- you don't need to Ubound($aMerchList) because the first element of $aMerchList is the total number of elements

- change:

MsgBox(0, "Error", "There was a problem opening webpage!")

with:

MsgBox(0, "Error", "There was a problem opening webpage: " & @error)

And write here the output.

Link to comment
Share on other sites

The first error returned after the long wait is the number 6, output being "There was a problem opening webpage: 6".  Then there are multiple errors for the remaining sites, that error is the number 2 for each.  From help, the error status codes correspond to:

6 ($_IEStatus_LoadWaitTimeout) - Load Wait Timeout

2 ($_IEStatus_COMError) - COM Error in Object reference

Link to comment
Share on other sites

Thanks for the suggestion but no luck, tried longer sleep times between navigates as well :(  Can others running this see the same timeout happening?  I am seeing it in multiple OSes so I would think it is not just me but i can't believe others aren't seeing this and I searched for this issue before posting.

Link to comment
Share on other sites

not SciTE, the version of AutoIt you are using, like 3.3.8.1 or 3.3.12.0

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

Found it, AutoIT is version 3.3.12.0.  I understand there are no errors, but could someone run the script and verify they get timeouts as well or does it complete the script?  Just want to make sure it is not my environment.

Link to comment
Share on other sites

worked for me with this:

For $i = 1 To $cNumMerchants
    ; THIS IS WHERE AUTOIT LOSES THE CONNECTION TO BROWSER AFTER ~2-3 URLS
    sleep(4000) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< added this to give time between navigations
    _IENavigate($oIE, $aMerchList[$i])
    If @error Then
        MsgBox(0, "Error", "There was a problem opening webpage!")
    EndIf
Next
Edited by MikahS

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

Strange, still does not work for me, I get the timeout after it hits the third URL every time, I have changed the third URL, I have tried it on clean VM machines both 32- and 64-bit, I am just bumfuzzled.  Can no one else see the timeout on the third URL?!?  Maybe I will try an older version of AutoIT, I never seemed to have this problem before updating.

Mikah are you on an older version of AutoIT?

Link to comment
Share on other sites

Adjust the sleep, I had to make sure every page loaded completely before it would navigate to the next. Try intervals of different sleep commands such as: 4000, 5000, 6000. Nope I am latest and greatest :)

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

  • 2 months later...

Have you tried my code with the adjusted sleep intervals?

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

I've seen issues with _iecreate, where mutliple instances are being opened.  Sometimes, the process isn't completely closed, causing future ones to not open.  Kill all the processes, or don't _iequit, and instead just navigate to the next url with the known IE.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

The SLEEP() suggestions will not help you in any way.

The important message is 6 ($_IEStatus_LoadWaitTimeout) - Load Wait Timeout.  This means that _IENavigate waited 5 minutes for one of the sites to finish loading and it didn't.  Internally, it is waiting for the document ReadyState to change to 4 or "completed" - you may actually see HTML rendered in the browser, but it still thinks it is waiting for more information from the web server.

You can circumvent this default behavior in _IENavigate (it is actually a behavior of _IELoadWait that _IENavigate and many other _IE functions call for you) by passing the NoWait flag to _IENavigate and then putting in your own logic to see if the browser page is ready to work with.  _IELoadWait also has a configurable timeout value that you can set... see the helpfile.

All that said, what jdelaney suggests is also prudent.

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

I've seen issues with _iecreate, where mutliple instances are being opened.  Sometimes, the process isn't completely closed, causing future ones to not open.  Kill all the processes, or don't _iequit, and instead just navigate to the next url with the known IE.

 

As you can see, I wasn't closing anything. As you said, navigating to the next url with the known IE.

For $i = 1 To $cNumMerchants
    ; THIS IS WHERE AUTOIT LOSES THE CONNECTION TO BROWSER AFTER ~2-3 URLS
    sleep(4000) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< added this to give time between navigations
    _IENavigate($oIE, $aMerchList[$i])
    If @error Then
        MsgBox(0, "Error", "There was a problem opening webpage!")
    EndIf
Next

 

The SLEEP() suggestions will not help you in any way.

The important message is 6 ($_IEStatus_LoadWaitTimeout) - Load Wait Timeout.  This means that _IENavigate waited 5 minutes for one of the sites to finish loading and it didn't.  Internally, it is waiting for the document ReadyState to change to 4 or "completed" - you may actually see HTML rendered in the browser, but it still thinks it is waiting for more information from the web server.

You can circumvent this default behavior in _IENavigate (it is actually a behavior of _IELoadWait that _IENavigate and many other _IE functions call for you) by passing the NoWait flag to _IENavigate and then putting in your own logic to see if the browser page is ready to work with.  _IELoadWait also has a configurable timeout value that you can set... see the helpfile.

All that said, what jdelaney suggests is also prudent.

Dale 

 

Is this because of the server thinking that it is not completed loading or your _IE functions think it is not loaded?

EDIT: Also, using _IELoadWait() is just doing what _IENavigate is suppose to do (but can't it seems), and setting the timeout is like setting a sleep() command, as in stopping the script until the desired amount of time has been hit, or the page has loaded, sleep just does not account for the page being loaded and just waits the full amount of time.

Edited by MikahS

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

  • Moderators

Is this because of the server thinking that it is not completed loading or your _IE functions think it is not loaded?

EDIT: Also, using _IELoadWait() is just doing what _IENavigate is suppose to do (but can't it seems), and setting the timeout is like setting a sleep() command, as in stopping the script until the desired amount of time has been hit, or the page has loaded, sleep just does not account for the page being loaded and just waits the full amount of time.

 

I'm so confused on what you're asking here... Just take a look at the UDF function, it does do a loop, it does set a timer if necessary, it even double checks.

That has nothing to do with the functions, but everything to do with the IE objects current state.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Well your confusion gave me the answer to the question.

I'll bow out of this, as I can tell my lack of experience and knowledge is getting in the way.

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

  • Moderators

Well your confusion gave me the answer to the question.

I'll bow out of this, as I can tell my lack of experience and knowledge is getting in the way.

Never bow out of a question if you have something that you feel may help.

I was just confused on what you were asking, and the bold was to iterate what I thought you might be confused on.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...