I often have a need to do this so wrote this general function that allows using a variety of alternative elements you can grab - it is quite straightforward but let me know if you need any explanation - no doubt it can be tidied up - but it does the job for me:
; Return $element on specified form of type "class/name/id/value..." etc with a given text label eg "submit" or "OK", which occurrance number (if the text value can appear more than once in the html code) and a html tag like "input/div/a..." etc
Func GetFormElement($form_name, $type, $label, $count = 1, $tag = "", $oIE)
Local $form, $element, $elements, $i = 1
If $form_name <> "" Then $form = _IEFormGetObjByName($oIE, $form_name)
If $form_name = "" Or @error Then
If $tag = "" Then
$elements = _IETagNameAllGetCollection($oIE)
Else
$elements = _IETagNameGetCollection($oIE, $tag)
EndIf
Else
$elements = _IEFormElementGetCollection($form)
EndIf
For $element In $elements
Switch $type
Case "class"
If _IEPropertyGet($element, "class") And StringInStr($element.class, $label) Then
If $i = $count Then Return $element
$i += 1
EndIf
Case "id"
If _IEPropertyGet($element, "id") And StringInStr($element.id, $label) Then
If $i = $count Then Return $element
$i += 1
EndIf
Case "name"
If _IEPropertyGet($element, "name") And $element.name = $label Then
If $i = $count Then Return $element
$i += 1
EndIf
Case "value", "title"
If StringInStr($element.outerhtml, $label, 1) And StringInStr($element.outerhtml, $type) Then
If $i = $count Then
If Not $LIVE Then ConsoleWrite("GETFORMELEMENT : 1 " & $element.outerhtml & @CRLF)
Return $element
EndIf
$i += 1
EndIf
Case "misc"
If StringInStr($element.outerhtml, $label) Then
If $i = $count Then Return $element
$i += 1
EndIf
EndSwitch
Next
Return 0
EndFunc ;==>GetFormElement