Function Reference


_IEGetObjById

Returns an object variable by id

#include <IE.au3>
_IEGetObjById ( ByRef $oObject, $sID )

Parameters

$oObject Object variable of an InternetExplorer.Application, Window or Frame object
$sID Specifies id of the object you wish to match

Return Value

Success: an object variable pointing to the specified Object.
Failure: sets the @error flag to non-zero.
@error: 3 ($_IEStatus_InvalidDataType) - Invalid Data Type
7 ($_IEStatus_NoMatch) - No Match

Remarks

This function will return an object reference to any object in the document with a specified id or name.
DOM elements can have Name or ID attributes or both.
A specific ID can be assigned to only a single element while a specific Name can be assigned to multiple elements.
In Internet Explorer, the Name and ID namespaces are shared.

Related

_IEGetObjByName

Example

; Open a browser to the basic example, get an object reference
; to the DIV element with the ID "line1". Display the innerText
; of this element to the console.

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

Local $oIE = _IE_Example("basic")
Local $oDiv = _IEGetObjById($oIE, "line1")

MsgBox($MB_SYSTEMMODAL, "Line1", $oDiv.innertext)