本帖最后由 lsb968 于 2013-8-22 04:00 编辑
网页地址:https://passport.csdn.net/account/login
网页源码如下:
<form name="logform" action="#">
<table cellspacing="8">
<tr>
<td width="70">帐 号:</td>
<td><input type="text" id="u" name="u" class="inputbox" maxlength="50" placeholder="邮箱/用户名" /></td>
</tr>
<tr>
<td>密 码:</td>
<td><input type="password" id="p" class="inputbox" maxlength="50" /></td>
</tr>
<tr>
<td></td>
<td><input type="checkbox" id="chkRemember" name="chkRemember" style="vertical-align:middle" class="checkbox" /><label for="chkRemember" class="font_red">记住我一周</label></td>
</tr>
<tr>
<td></td>
<td>
<a id="aLogin" class="btn_login" href="javascript:void(0);"><span>登 录</span></a>
试了三种方法都不行……
;第一种
#include <IE.au3>
$oIE = _IECreate ("https://passport.csdn.net/account/login",0,1,1,0)
_IEPropertySet ($oIE, "width", 800)
_IEPropertySet ($oIE, "height", 600)
$oForm = _IEFormGetObjByName ($oIE, "logform")
$oQuery =_IEGetObjById ($oForm, "u")
_IEFormElementSetValue ($oQuery,''XXXXXX")
$oQuery = _IEGetObjById ($oForm, "p")
_IEFormElementSetValue ($oQuery, ''XXXXX')
$oIE.document.getElementsByTagName('button').item(0).click
_IEAction ($oIE, "visible")
;第二种
#include <IE.au3>
$oIE = _IECreate ("https://passport.csdn.net/account/login")
$oUser = _IEGetObjById ($oIE, "u")
$oPass = _IEGetObjById ($oIE, "p")
_IEFormElementSetValue ($oUser, "XXXXX")
_IEFormElementSetValue ($oPass, "XXXXX")
$oLogin = _IEGetObjById ($oIE, "aLogin")
$oLogin.click()
;第三种
#include <IE.au3>
$oIE = _IECreate("https://passport.csdn.net/account/login", 0, 1, 1, 0)
_IELoadWait($oIE)
_IEPropertySet($oIE, "width", 800)
_IEPropertySet($oIE, "height", 600)
$oInputs = _IETagNameGetCollection($oIE, "INPUT")
For $oInput In $oInputs
If $oInput.id = "u" Then
$oInput.value = 'XXXXXXXXX'
EndIf
Next
For $oInput In $oInputs
If $oInput.id = "p" Then
$oInput.value = 'XXXXXX'
EndIf
Next
$oIE.document.getElementsByTagName('button').item(0).click
For $oInput In $oInputs
If $oInput.id = "aLogin" Then
_IEAction($oInput, "click")
EndIf
Next
|