Returns a collection object of all elements in the object with the specified TagName or a single element by index
#include <IE.au3>
_IETagNameGetCollection ( ByRef $oObject, $sTagName [, $iIndex = -1] )
$oObject | Object variable of an InternetExplorer.Application, Window, Frame, iFrame or any object in the DOM |
$sTagName | TagName of collection to return (e.g. IMG, TR etc.) |
$iIndex | [optional] specifies whether to return a collection or indexed instance 0 or positive integer returns an indexed instance -1 = (Default) returns a collection |
Success: | an object variable containing the specified Tag collection, @extended = specified 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, the specified elements in the document are returned.
If the object passed is an object inside the document (e.g. a TABLE object), then only the specified elements inside that object are returned.
; Open a browser with the form example, get the collection
; of all INPUT tags and display the formname and type of each
#include <IE.au3>
#include <MsgBoxConstants.au3>
Local $oIE = _IE_Example("form")
Local $oInputs = _IETagNameGetCollection($oIE, "input")
Local $sTxt = ""
For $oInput In $oInputs
$sTxt &= $oInput.type & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Form Input Type", "Form: " & $oInput.form.name & @CRLF & @CRLF & " Types :" & @CRLF & $sTxt)
_IEQuit($oIE)