Function Reference


Returns a collection object all elements in the document or document hierarchy in source order or a single element by index

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


$oObject Object variable of an InternetExplorer.Application, Window, Frame, iFrame or any object in the DOM
$iIndex [optional] specifies whether to return a collection or indexed instance
    0 or positive integer returns an indexed instance
    -1 = (Default) returns a collection

Return Value

Success: an object variable containing the Tag collection, @extended = Tag count.
Failure: sets the @error flag to non-zero.
@error: 3 ($_IEStatus_InvalidDataType) - Invalid Data Type
4 ($_IEStatus_InvalidObjectType) - Invalid Object Type
5 ($_IEStatus_InvalidValue) - Invalid Value
7 ($_IEStatus_NoMatch) - No Match
@extended: Contains invalid parameter number


The DOM is hierarchical, so if the object passed is the document object, all elements in the document are returned.
If the object passed in is an object inside the document (e.g. a TABLE object), then only the elements inside that object are returned.




; Open a browser with the basic example, get the collection
; of all elements and display the tagname and innerText of each

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

Local $oIE = _IE_Example("basic")
Local $oElements = _IETagNameAllGetCollection($oIE)
For $oElement In $oElements
    If $ Then MsgBox($MB_SYSTEMMODAL, "Element Info", "Tagname: " & $oElement.tagname & @CRLF & "id: " & $ & @CRLF & "innerText: " & $oElement.innerText)