找回密码
 加入
搜索
查看: 1358|回复: 6

看似简单,这个网站如何自动登录

[复制链接]
发表于 2009-10-1 21:13:33 | 显示全部楼层 |阅读模式
本帖最后由 yokoliu 于 2009-10-3 08:11 编辑

网站入口:http://www.zhubajie.com/task/user/login
用户名密码都可以用_IEGetObjById操作,
但是就是提交不了。
发表于 2009-10-1 23:16:59 | 显示全部楼层
好久没写了,随便写一个,

#include <IE.au3>
 
$oIE = _IECreate("http://www.zhubajie.com/task/user/login",0,1,1,1 )
 
_IELoadWait ($oIE)
 
$oInputs = _IETagNameGetCollection ($oIE, "INPUT")
 
For $oInput In $oInputs
if $oInput.name = "username" then
       $oInput.value="用户名"
EndIf
Next
 
For $oInput In $oInputs
if $oInput.name = "userpass" then
       $oInput.value="密码"
EndIf
Next
 
 
For $oInput In $oInputs
if $oInput.name = "login" then
       $oInput.click
EndIf
Next
Exit


另外楼主是个好吃懒做的人,自己搜索学习吧

评分

参与人数 1金钱 +5 收起 理由
yokoliu + 5 谢谢您!!!

查看全部评分

 楼主| 发表于 2009-10-1 23:26:22 | 显示全部楼层
先谢谢你了老大,
您真的冤枉我了,
我是找了好久没有答案才发帖求助的。
我用一下代码为什么不行呢?

#include <IE.au3>

$oIE = _IECreate("http://www.zhubajie.com/task/user/login",0,1,1,1 )

_IELoadWait ($oIE)

$oInputs = _IETagNameGetCollection ($oIE, "INPUT")

For $oInput In $oInputs
if $oInput.name = "username" then
       $oInput.value="aiboboxx"
EndIf
Next

For $oInput In $oInputs
if $oInput.name = "userpass" then
       $oInput.value="780830lp"
EndIf
Next


$oInput = _IEGetObjByName($oIE,"login")

_IEAction($oInput,"click")
 楼主| 发表于 2009-10-1 23:34:12 | 显示全部楼层
改为这样又可以了 。 明白了,网页上有两个name为“login”的元素,一个是form,一个是input
有的时候就是简单的问题绕不过来,kn007 老大谢谢了!!!

#include <IE.au3>

$oIE = _IECreate("http://www.zhubajie.com/task/user/login",0,1,1,1 )

_IELoadWait ($oIE)

$oInputs = _IETagNameGetCollection ($oIE, "INPUT")

For $oInput In $oInputs
if $oInput.name = "username" then
       $oInput.value="aiboboxx"
EndIf
Next

For $oInput In $oInputs
if $oInput.name = "userpass" then
       $oInput.value="780830lp"
EndIf
Next


For $oInput In $oInputs
if $oInput.name = "login" then
       _IEAction($oInput,"click")
EndIf
Next
Exit
发表于 2009-10-2 07:29:22 | 显示全部楼层
解决就好,记得改下标题,
发表于 2009-10-2 23:19:55 | 显示全部楼层
本帖最后由 ashfinal 于 2009-10-2 23:22 编辑

#include <IE.au3>
$oIE=_IECreate ("http://www.zhubajie.com/task/user/login",0,1,1,1)
$oForm = _IEGetObjByName ($oIE,"login")
$oQuery1 = _IEFormElementGetObjByName ($oForm,"username")
_IEFormElementSetValue ($oQuery1,"用户名")
$oQuery2 = _IEFormElementGetObjByName ($oForm,"userpass")
_IEFormElementSetValue ($oQuery2,"密码")
$oQuery3 = _IEFormElementGetObjByName ($oForm,"login")
;_IEFormSubmit($oForm)
_IEAction($oQuery3,"click")

我是用上面代码登陆的,只是想请问下各位老大,为什么直接提交表单不行呢?
发表于 2010-1-23 00:14:20 | 显示全部楼层
网站防止POST数据!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-9-28 02:16 , Processed in 0.154932 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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