Function Reference


_IELoadWait

Wait for a browser page load to complete before returning

#include <IE.au3>
_IELoadWait ( ByRef $oObject [, $iDelay = 0 [, $iTimeout = -1]] )

Parameters

$oObject Object variable of an InternetExplorer.Application or DOM element
$iDelay [optional] Milliseconds to wait before checking status
$iTimeout [optional] Period of time to wait before exiting function (default = 300000 ms aka 5 min)

Return Value

Success: 1.
Failure: 0 and sets the @error flag to non-zero.
@error: 1 ($_IEStatus_GeneralError) - General Error
3 ($_IEStatus_InvalidDataType) - Invalid Data Type
4 ($_IEStatus_InvalidObjectType) - Invalid Object Type
6 ($_IEStatus_LoadWaitTimeout) - Load Wait Timeout
8 ($_IEStatus_AccessIsDenied) - Access Is Denied
9 ($_IEStatus_ClientDisconnected) - Client Disconnected
@extended: Contains invalid parameter number

Remarks

Several IE.au3 functions call _IELoadWait() automatically (e.g. _IECreate(), _IENavigate() etc.).
Most functions that do this also allow you to turn this off with a $fWait parameter if you do not want the wait or if you want to call it yourself.

When document objects or DOM elements are passed to _IELoadWait(), it will check the readyState of the container elements up to and including the parentWindow.

Browser scripting security restrictions may sometimes prevent _IELoadWait() from guaranteeing that a page is fully loaded and can occasionally result in untrapped errors.
In these cases you may need to avoid calling _IELoadWait() and attempt to employ other methods of insuring that the page load has completed.
These methods might include using a Sleep command, examining browser status bar text and other methods. When using functions that call _IELoadWait() for objects other than the InternetExplorer (browser) object, you may also be successful by calling _IELoadWait() for the browser yourself (e.g. _IELoadWait($oIE)).

The most common causes of trouble are page redirects and cross-site scripting security restrictions associated with frames. Page re-writing techniques employed by some applications (e.g. Gmail) can also cause trouble here.

Related

_IEAction, _IEBodyWriteHTML, _IECreate, _IEDocWriteHTML, _IEFormImageClick, _IEFormSubmit, _IEImgClick, _IELinkClickByIndex, _IELinkClickByText, _IELoadWaitTimeout, _IENavigate

Example

; Open the AutoIt forum page, tab to the "View new posts"
; link and activate the link with the enter key.
; Then wait for the page load to complete       before moving on.

#include <IE.au3>

Local $oIE = _IECreate("http://www.autoitscript.com/forum/index.php")
Send("{TAB 12}")
Send("{ENTER}")
_IELoadWait($oIE)