找回密码
 加入
搜索
查看: 5720|回复: 2

[IE类操作] 页面“submit”按钮用_IEGetObjByID(IE8中有效,IE9中无效)困难

[复制链接]
发表于 2012-4-9 14:30:31 | 显示全部楼层 |阅读模式
#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 @ERROR  then 
        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)
发表于 2012-4-9 22:08:01 | 显示全部楼层
回复 1# lsszmj
IE 9 没试过, IE6 倒试过.
那时发现工作很不正常, 最后只能是升级到 IE8 才解决问题!

我估计 IE.AU3 的函数是建立在 IE8 的基础上吧?
IE9 太'先进', IE6 太'落后', 所以支持都不好!
 楼主| 发表于 2012-4-10 00:00:18 | 显示全部楼层
回复 2# user3000
谢谢user3000大大。期待高手中~~~~
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-6-13 00:48 , Processed in 0.088178 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表