Here is my IELoadWait 'helper' function and samples how I use them from other functions.
Note the necessary page timeout feature for lazy pages or server downtime. Works for me.
TODO: Error tracking should be improved. (w/ SetError())
TODO: Return to calling page on failure.
Func _IELoadWait(ByRef $oIE, $iPageTimeout = 10)
;;TODO: Error tracking should be improved. (w/ SetError())
;;TODO: Return to calling page on failure.
Local $iTimeIni = TimerInit()
While TimerDiff($iTimeIni) < $iPageTimeout * 1000;convert to miliseconds
Sleep(50)
If Not $oIE.busy Then
If $oIE.readyState = "complete" Or $oIE.readyState = 4 Then Return (1 And Not @error)
EndIf
WEnd
$oIE.Stop ()
;$oIE.GoBack ()
Return (0)
EndFunc ;==>_IEWait
Func _IENavigate(ByRef $oIE, $sUrl, $iPageTimeout = 20)
$oIE.navigate ($sUrl)
Return (_IELoadWait($oIE, $iPageTimeout) And Not @error)
EndFunc ;==>_IENavigate
Func _IEFormSubmitByName(ByRef $oIE, $sFormName, $iPageTimeout = 40);increase when uploading files
$oIE.document.getElementById ($sFormName).submit
Return (_IELoadWait($oIE, $iPageTimeout) And Not @error)
EndFunc ;==>_IEFormSubmitByName
;;... and so on ...;;