Hallo,
gerade angemeldet und schon die erste Frage...
Also ich habe ein Dropdown-Element auf einer Webseite und moechte die 2. Option dort auswaehlen.
Es gibt 2 Dropdown-Menues auf der Seite, deshlab auch _IEFormGetCollection($oIE, 1) und nicht 0.
Mein Ansatz sieht so aus:
[autoit]
$oForm = _IEFormGetCollection($oIE, 1)
$oFile = _IEFormElementGetObjByName($oForm, "return")
_IEFormElementOptionSelect($oFile, 1, 1, "byIndex")
Wenn ich das hier ausfuehre:
[autoit]
$oForms=_IEFormGetCollection($oIE)
MsgBox(0,"Forms Info","There are "&@extended&" forms on this page")
For $oForm In $oForms MsgBox(0,"Form Info",$oForm.name)
Next
Kommt 2 dabei raus, allerdings bei den Namen jeweils "0"... also nix...
Die Form liegt in einem Div und sieht gemaess quelltext so aus:
Spoiler anzeigen
Der Wert in <OPTION value=1> ist immer anders, sodass ich nicht bytext nehmen kann...
Waere super wenn mir da jemand helfen koennte!
Gruss
Sir En
Loesung:
[autoit]
$oForm = $oIE.document.getElementById("send") ; by ID
;~ $oForm = $oDocument.forms.item(1) ; get Form count 1
$oSelect = $oForm.elements.item("return") ; "Select"-Item
$oSelect.options.item(2).selected = True ; Select item 2