Function Reference


_IELinkClickByIndex

Simulate a mouse click on a link by 0-based index (in source order)

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

Parameters

$oObject Object variable of an InternetExplorer.Application, Window or Frame object
$iIndex 0-based index of the link you wish to match
$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
7 ($_IEStatus_NoMatch) - No Match
8 ($_IEStatus_AccessIsDenied) - Access Is Denied
9 ($_IEStatus_ClientDisconnected) - Client Disconnected
@extended: Contains invalid parameter number

Remarks

Not all elements that appear to be links actually are.
It is common practice to attach onClick JavaScript events to other DOM elements to simulate the behavior of links.
To activate such elements, use "click" with _IEAction().

Related

_IELinkClickByText, _IELoadWait

Example

; Open browser with basic example, click on the 3rd link
; on the page (note: the first link is index 0)

#include <IE.au3>

Local $oIE = _IE_Example("basic")
_IELinkClickByIndex($oIE, 2)