Function Reference


_IENavigate

Directs an existing browser window to navigate to the specified URL

#include <IE.au3>
_IENavigate ( ByRef $oObject, $sUrl [, $iWait = 1] )

Parameters

$oObject Object variable of an InternetExplorer.Application, Window or Frame object
$sUrl URL to navigate to (e.g. "http://www.autoitscript.com")
$iWait [optional] specifies whether to wait for page to load before returning
    0 = Return immediately, not waiting for page to load
    1 = (Default) Wait for page load to complete before returning

Return Value

Success: None.
Failure: 0 or -1 and sets the @error flag to non-zero.
@error: 1 ($_IEStatus_GeneralError) - General Error
2 ($_IEStatus_COMError) - COM Error in Object reference
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

This function always returns a value of -1.
This is because the navigate method has no useful return value and therefore nothing can be implied from it.
You will need to employ other methods to determine success or failure of the navigation.

New security in Windows Vista causes a new browser window to be created when a browser is instructed to navigate to a URL in a different security zone.
This occurs as well with the initial creation and navigation initiated with _IECreate(). The new window is a new browser instance and the previous browser object variable no longer points to it.
There are several workarounds:
    1) add #RequireAdmin to your code (this is required even if the account is part of the Administrator's Group and will prompt for credentials if necessary),
    2) use _IEAttach() to connect to the new browser window
    3) add the target website to the Trusted Sites security zone in IE,
    4) turn off "Protected Mode" in IE,
    or 5) disable UAC. Care must be taken to understand the implications of disabling IE security features when accessing untrusted sites.

Related

_IECreate, _IECreateEmbedded, _IELoadWait

Example

Example 1

; Create a browser window and navigate to a website,
; wait 5 seconds and navigate to another
; wait 5 seconds and navigate to another

#include <IE.au3>

Local $oIE = _IECreate("www.autoitscript.com")
Sleep(5000)
_IENavigate($oIE, "http://www.autoitscript.com/forum/index.php?")
Sleep(5000)
_IENavigate($oIE, "http://www.autoitscript.com/forum/index.php?showforum=9")

Example 2

; Create a browser window and navigate to a website,
; do not wait for page load to complete before moving to next line

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IECreate("www.autoitscript.com", 0)
MsgBox($MB_SYSTEMMODAL, "_IENavigate()", "This code executes immediately")