How to use _IEFormElementRadioSelect without finding a Form
I need this script to work, but without using _IEFormGetObjByName
or _IEFormGetCollection
, and while knowing only the Name
of the radio buttons.
$oIE = _开发者_运维技巧IE_Example ("form")
$oDoc = _IEDocGetObj($oIE)
$oArray = $oDoc.getElementsByTagName ("input")
For $element In $oArray
If $element.Name = "radioExample" Then
_IEFormElementRadioSelect ($oDoc,2, "radioExample", 1, "byIndex")
msgbox(0,"","Found it")
Endif
Next
_IEFormElementGetValue
& _IEAction
work great, just reference them to the $oElement
, and search for an appropriate $element.Name
, but I can't get the _IEFormElementRadioSelect to work.
The only difference between the _IEFormElementRadioSelect
command from the example script found in the AutoIt helpfile is the reference to $oDoc
. In the helpfile this is $oForm
, which is found with a _IEFormGetObjByName
, which I can't use (the site I'm automating doesn't return any forms).
Replace your _IEFormElementRadioSelect
with _IEAction($element, "click")
Try this example; you can see the radio items being selected as the script runs:
#include <IE.au3>
$oIE = _IE_Example("form")
$oDoc = _IEDocGetObj($oIE)
$oArray = $oDoc.getElementsByTagName("input")
For $element In $oArray
If $element.Name = "radioExample" Then
_IEAction($element, "click")
Sleep(2000)
EndIf
Next
精彩评论