Jump to content

IENavigate not waiting for page to fully load.


Champak
 Share

Recommended Posts

I'm trying to navigate to http://www.traffic.com/New-York-Traffic/New-York-Traffic-Reports-Hotspots.html but the script continues on even though I have IENavigate set up with the default wait at 1. I even tried IELoadWait right behind it, but that didn't help. Is there a workaround to force a wait? I don't want to use sleep, because that would be just as undependable with regards to the cpu load, server load, internet speed, and anything else.

Link to comment
Share on other sites

You can be fooled by AJAX routines... the page actually does load and gives a READY state, but async processing can occur after that load. Best suggestion is to figure out an element in that dynamically created section and check for its existance before you move on with your processing.

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 dont fully understand what/how you mean, but this is what I came up with that seems to work. However, if your way is cleaner, please show me.

#include <WindowsConstants.au3>
#Include <Array.au3>
#include <IE.au3>
#include <Array2.au3>
_IEErrorHandlerRegister("_MyErrFunc")
_IEErrorHandlerDeRegister()
_IEErrorHandlerRegister()
$OIE = _IECreate("", 0, 1)
_IENavigate($OIE, "http://www.traffic.com/New-York-Traffic/New-York-Traffic-Reports-Hotspots.html")
Do
$oFrame = _IETagNameGetCollection($oIE, "tr",2)
$UU = @error
Until $UU = "0" And $oFrame.id = "nvt_widget14_row0"

$oFramer = _IETableGetCollection($OIE, 1)
$rr = _IETableWriteToArray($oFramer)
_ArrayDisplay($rr)
_IEQuit($OIE)
Exit
Func _MYERRFUNC()
$HEXNUMBER = Hex($OIEERRORHANDLER.number, 8)
MsgBox(0, "COM Error", "INM intercepted a COM Error !" & @CRLF & @CRLF & "err.description is: " & @TAB & $OIEERRORHANDLER.description & @CRLF & "err.windescription:" & @TAB & $OIEERRORHANDLER.windescription & @CRLF & "err.number is: " & @TAB & $HEXNUMBER & @CRLF & "err.lastdllerror is: " & @TAB & $OIEERRORHANDLER.lastdllerror & @CRLF & "err.linecode is: " & @TAB & $OIEERRORHANDLER.scriptline)
SetError(1)
EndFunc   ;==>_MYERRFUNC
Func _CONSOLEWRITE($CONSOLEINFO)
ConsoleWrite($CONSOLEINFO & @CRLF & @CRLF)
EndFunc   ;==>_CONSOLEWRITE
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...