How to use _IEFormElementRadioSelect without finding a Form

非 Y 不嫁゛ 提交于 2019-12-13 06:45:23

问题


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).


回答1:


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


来源:https://stackoverflow.com/questions/7417940/how-to-use-ieformelementradioselect-without-finding-a-form

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!