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

[IE类操作] ie.au3 提交不了

[复制链接]
发表于 2010-9-13 21:03:33 | 显示全部楼层 |阅读模式
本帖最后由 huguanglai 于 2010-9-13 21:15 编辑

下面是我的写的代码,但是就是提交不了.
#include <IE.au3>
$oIE = _IECreate ("mail.163.com",0,1,1,0)

$ofrm=_IEFormGetObjByName($oIE,"login163")
$oquest1=_IEFormElementGetObjByName($ofrm,"username")
_IEFormElementSetValue($oquest1,"11111")
$oquest2=_IEFormElementGetObjByName($ofrm,"password")
_IEFormElementSetValue($oquest2,"11111")
$oQuery = _IEFormElementGetObjByName ($ofrm, "selType")
_IEFormElementOptionSelect ($oQuery , 1, 1, "byIndex")

$osubmit = _IEFormElementGetObjByName ($ofrm, "登 录")
_IEFormSubmit($osubmit)



这个是网页代码:<button class="btn btn-login" onMouseOver="this.className+=' btn-login-hover'" onMouseDown="this.className+=' btn-login-active'" onMouseOut="this.className='btn btn-login'" onMouseUp="this.className='btn btn-login'" tabindex="6" type="submit" onClick="if(window.location.href.indexOf('#return') == -1){setCookie('ntes_mail_firstpage','normal');}saveLoginType();">登 录</button>


那位高手过来解释下
发表于 2010-9-15 12:43:03 | 显示全部楼层
$osubmit = _IEFormElementGetObjByName ($ofrm, "登 录")  ;错误了,该语句无法获取按钮对象。
_IEFormSubmit($osubmit)  ;这个函数用法也错了,参数应该是表单对象。

下面是改进后的代码:
#include <IE.au3>

$oIE = _IECreate ("mail.163.com",0,1,1,0)
$ofrm=_IEFormGetObjByName($oIE,"login163")
$oquest1=_IEFormElementGetObjByName($ofrm,"username")
_IEFormElementSetValue($oquest1,"11111")
$oquest2=_IEFormElementGetObjByName($ofrm,"password")
_IEFormElementSetValue($oquest2,"11111")
$oQuery = _IEFormElementGetObjByName ($ofrm, "selType")
_IEFormElementOptionSelect ($oQuery , 1, 1, "byIndex")

Dim $oButtons, $oLogin

$oButtons = _IETagNameGetCollection($oIE, 'button', -1)
If IsObj($oButtons) Then
        For $oLogin In $oButtons
                If StringInStr($oLogin.className(), 'btn-login') And StringInStr($oLogin.innerText(), '登 录') Then
                        $oLogin.click()
                        ExitLoop
                EndIf
        Next
Else
        MsgBox(64, '提示', '登陆失败!')
EndIf
发表于 2010-9-15 16:41:38 | 显示全部楼层
$osubmit = _IEFormElementGetObjByName ($ofrm, "登 录")  ;错误了,该语句无法获取按钮对象。
_IEFormS ...
baikaifang 发表于 2010-9-15 12:43



    又学习了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-18 18:37 , Processed in 0.079497 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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