页面“submit”按钮用_IEGetObjByID(IE8中有效,IE9中无效)困难
#include <IE.au3>#include <Date.au3>
$file_ok=@TempDir & "\ESET_30天临时ID.txt"
DirCreate($file_ok)
$browser_old='"C:\Program Files\Internet Explorer\iexplore.exe" -nohome'
$temp_Email="xx88@eset.qc.to"
$IE = _IECreate("http://www.eset.eu/download/ess-trial-form")
$oFrames = _IEFrameGetCollection($IE)
$iNumFrames = @extended
For $i = 0 To ($iNumFrames - 1)
$oFrame = _IEFrameGetCollection($IE, $i)
; MsgBox(0, "Frame Info", _IEPropertyGet ($oFrame, "locationurl"))
Next
;$oIE = _IECreate(_IEPropertyGet($oFrame, "locationurl"))
;-------------正在打开内嵌框架网页---------------------
TrayTip("【精睿·网络安全】", "正在提交给ESET.... ", 35, 1)
FileWriteLine($file_ok, "【"& _Now() & "】"& "得到申请ID页面内置框架地址,正在打开页面并提交数据..."& @CRLF)
$oIE = _IECreate (_IEPropertyGet ($oFrame, "locationurl"))
$T = _IEBodyReadText($oIE)
;MsgBox(64, $oIE,$T)
;MsgBox(64, $oIE,StringInStr($T, "Email.:" ))
If StringInStr($T, "Email.:") = 0 Then
;if @ERRORthen
TrayTip("错误", "无法连接到ESET Trial 30天ID内嵌申请页面!,3秒后退出", 5, 3)
FileWriteLine($file_ok, "【"& _Now() & "】"& "错误,无法连接到ESET Trail 30天ID内嵌申请页面!" & @CRLF)
RegWrite("HKEY_CLASSES_ROOT\http\shell\open\command", "", "REG_SZ", $browser_old)
FileWriteLine($file_ok, "【"& _Now() & "】"& "本机默认浏览器程序恢复为" & $browser_old & @CRLF)
FileWriteLine($file_ok, "【"& _Now() & "】"& "程序运行结束" & @CRLF)
FileWriteLine($file_ok, "*********************************************************")
FileClose($file_ok)
sleep(2000)
_IEQuit ($oIE)
_IEQuit ($IE)
Run("notepad.exe ESET_30天临时ID.txt")
Exit
EndIf
$oForms = _IEFormGetCollection ($oIE)
$iNumForms = @extended
;MsgBox(0, "Forms Info", "There are " & $iNumForms & " forms on this page")
;-------------得到表单名称---------------------
For $i = 0 to $iNumForms - 1
$oForm = _IEFormGetCollection ($oIE, $i)
;MsgBox(0, "Form Info", $oForm.name)
Next
;-------------从表单遍历表单元素---------------------
$oForm = _IEFormGetObjByName ($oIE, $oForm.name)
$oQuerys = _IEFormElementGetCollection ($oForm)
For $Query In $oQuerys
TrayTip("表单控件信息", "名称:"& $Query.name & " 类型:"&$Query.type,3,1)
;FileWriteLine($file_ok, "【"& _Now() & "】"& "表单控件信息:名称:"& $Query.name & " 类型:"&$Query.type & @CRLF)
;-------------如果元素类型为“Text”,则填入临时邮件地址---------------------
If $Query.type = "Text" then
$oText = _IEFormElementGetObjByName ($oForm, $Query.name)
_IEFormElementSetValue ($oText, $temp_Email)
EndIf
Next
;-------------如果元素类型为“submit”,则将此元素名称付给$submit_name,以便提交表单--------------------
If $Query.type = "submit" then $submit_name=$Query.name
Next
;-------------提交表单--------------------
;_IEAction ($oForm, "click")
$OK = _IEGetObjByID($oIE, $submit_name);通过工具查询到得登陆按钮ID值,,,,
IE9中无效。
$OK.click ;点击提交按钮,,,,IE9中无效。
TrayTip("【精睿·网络安全】", "提交完毕,正在等待ESET回复....", 35, 1)
FileWriteLine($file_ok, "【"& _Now() & "】"& "提交完毕,正在等待ESET回复.... "& @CRLF)
_IELoadWait ($oIE) 回复 1# lsszmj
IE 9 没试过, IE6 倒试过.
那时发现工作很不正常, 最后只能是升级到 IE8 才解决问题!
我估计 IE.AU3 的函数是建立在 IE8 的基础上吧?
IE9 太'先进', IE6 太'落后', 所以支持都不好! 回复 2# user3000
谢谢user3000大大。期待高手中~~~~
页:
[1]