$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
|