Simulate a mouse click on an <input type=image>. Match by sub-string match of alt text, name or src
#include <IE.au3>
_IEFormImageClick ( ByRef $oObject, $sLinkText [, $sMode = "src" [, $iIndex = 0 [, $iWait = 1]]] )
$oObject | Object variable of any DOM element (will be converted to the associated document object) |
$sLinkText | Value used to match element - treatment based on $sMode |
$sMode | [optional] specifies search mode "src" = (Default) match the url of the image "id" = match the id of the image (see remarks) "alt" = match the alternate text of the image |
$iIndex | [optional] If the img text occurs more than once, specifies which instance you want by 0-based index |
$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 |
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 5 ($_IEStatus_InvalidValue) - Invalid Value 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 |
The <input type=image> form element is handled differently from all others.
It is not recognized by Internet Explorer as a member of the form element collection and this function therefore gives you other means of getting a reference to it within the document using src, name or alt strings.
Regardless of the object passed to this function, it looks for the form element within the full document context.
"name" is no more supported when using HTLM5 but still accepted and equivalent to "id" for HTML5 pages.
_IEImgClick, _IEImgGetCollection, _IELoadWait
; Open a browser with the form example, click on the
; <input type=image> form element with matching alt text
#include <IE.au3>
Local $oIE = _IE_Example("form")
_IEFormImageClick($oIE, "AutoIt Homepage", "alt")
; Open a browser with the form example, click on the <input type=image>
; form element with matching img source URL (sub-string)
#include <IE.au3>
Local $oIE = _IE_Example("form")
_IEFormImageClick($oIE, "autoit_6_240x100.jpg", "src")
; Open a browser with the form example, click on the
; <input type=image> form element with matching name
#include <IE.au3>
Local $oIE = _IE_Example("form")
_IEFormImageClick($oIE, "imageExample", "name")