找回密码
 加入
搜索
查看: 9756|回复: 9

AU3如何自动登陆网页

  [复制链接]
发表于 2008-8-24 12:35:58 | 显示全部楼层 |阅读模式
自动打开一个页面,输入帐号,密码,然后自动点登陆图标

帐号名是根据计算机名获取的,密码可以从配置文件获取

请问如何做?

登陆网页的地址:

http://vip.yzvod.com/logon.aspx
 楼主| 发表于 2008-8-30 13:19:40 | 显示全部楼层
为啥没人呢
 楼主| 发表于 2008-8-31 12:11:49 | 显示全部楼层
发表于 2008-9-1 15:12:41 | 显示全部楼层
啥鸟网站,打不开
限定了区域IP吧
发表于 2008-9-1 16:23:50 | 显示全部楼层
这个是官方的例子....函数用法 帮助里面有说明

自己对照你的那个页面 修改下就好了

#include <IE.au3>
$oIE = _IECreate ("http://www.google.com")
$oForm = _IEFormGetObjByName ($oIE, "f")
$oQuery = _IEFormElementGetObjByName ($oForm, "q")
_IEFormElementSetValue ($oQuery, "AutoIt IE.au3")
_IEFormSubmit ($oForm)
 楼主| 发表于 2008-9-2 13:13:10 | 显示全部楼层

这是网页原码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
        扬州宽带网
</title></head>
<body>
    <form name="form1" method="post" action="logon.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTExMzM3NzE1ODYPFgIeBFJVUkwFCmluZGV4LmFzcHhkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYBBQhidG5Mb2dpbrxpFOCCxx+hOg2CbHt7hmU+UvJs" />
</div>

        <div>
                        <div style="width:382px; border:1px #CCCCCC solid;">
                                <div  style="width:382px; height:127px; background:url(/images/login_pic.jpg) no-repeat top;"></div>
                                <div  style="text-align:center; margin:15px 55px;">
                                        <div style="float:left;">
                                                <div style=" font-size:12px; line-height:120%;">
                                                        帐&nbsp;&nbsp;号:
                                                        <input name="txtAccount" type="text" id="txtAccount" style="height:14px;" />
                                                </div>
                                                <div style="margin-top:8px;font-size:12px; line-height:120%;">
                                                        密&nbsp;&nbsp;码:
                                                        <input name="txtPassword" type="password" id="txtPassword" style="height:14px;" />
                         </div>
                                        </div>
                                        <div style="float:right;">
                                        <input type="image" name="btnLogin" id="btnLogin" src="/images/login_menu.jpg" style="border-width:0px;" />
                                        </div>
                                        <div style="clear:both;"></div>
                                </div>
                                <div  style="margin:10px; text-align:right">
                                        <span>还没有注册请点击这里<a href="/reg.aspx">注册</a></span>
                                        <span style=" margin-left:15px;">[<a href="javascript:closeMessageLoin();">关闭窗口</a>]</span>
                                </div>
                        </div>
        </div>
   
<div>

        <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBAKRo77bBAKUj8fhDAK1qbSRCwKC3IeGDPjyZD+s66MNtH9Sv+lpw5eBegyS" />
</div></form>
</body>
</html>
 楼主| 发表于 2008-9-2 13:14:01 | 显示全部楼层

这是我写的AU3原码,没有办法自动点确定,极度郁闷中,哪位大侠指点一下.

#include <IE.au3>
;可以选,也可以写死到脚本,也可写到ini文件或注册表文件,看你喜欢
$username = @ComputerName
dim $passwd = "12345679"

$oIE = _IECreate ("http://vip.yzvod.com/logon.aspx")
$oForm = _IEFormGetObjByName ($oIE, "form1");找一个名字叫"form1"的form表单
$ouser = _IEFormElementGetObjByName ($oForm, "txtAccount");从上面的form表单里找一个名字叫txtAccount的单元
$opasswd = _IEFormElementGetObjByName ($oForm, "txtPassword");从上面的form表单里找一个名字叫txtPassword的单元
_IEFormElementSetValue ($ouser, $username);设置值
_IEFormElementSetValue ($opasswd, $passwd);设置值
$oSubmit = _IEFormElementGetObjByName ($oForm, "btnLogin");从上面的form表单里找一个名字叫btnLogin的单元
_IEAction ($oSubmit, "click");做click的action
Send("{ENTER}")
发表于 2008-9-2 17:51:19 | 显示全部楼层
啥鸟网站,打不开

看不到网页,怎么帮你?
发表于 2008-9-2 23:21:32 | 显示全部楼层
测试的确是打不开。没人帮到你了。
发表于 2008-9-2 23:56:24 | 显示全部楼层
用IE UDF里的函数
点击这个图片就可以了赛
<input type="image" name="btnLogin" id="btnLogin" src="/images/login_menu.jpg" style="border-width:0px;" />
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-24 11:49 , Processed in 0.079191 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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