找回密码
 加入
搜索
查看: 2221|回复: 4

[IE类操作] 代码在有的机器好用 有的报错

[复制链接]
发表于 2010-11-12 09:13:39 | 显示全部楼层 |阅读模式
前段时间在论坛看到了一段自己添网页帐号和密码的代码
$oIE = ObjCreate("InternetExplorer.Application")
        $oIE.visible = 1
        $oIE.navigate('http://192.168.99.6')
        $oIE.height = 600
        $oIE.width = 800
        Do
        Until $oIE.busy = False Or $oIE.readyState = 4
        $oIE.document.getElementById('username' ).value = 'admin'
        $oIE.document.getElementById('pwd' ).value = 'lzy2236*.*'
        Sleep(2000)
        Send("{enter}")
在大部分机器都好用,但是在有点机器上报错 图片如下:


这是为什么呢???????????

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2010-11-12 09:31:23 | 显示全部楼层
在  $oIE = ObjCreate("InternetExplorer.Application") 后面加个判断,检查一下
发表于 2010-11-12 09:33:49 | 显示全部楼层
我也遇到过这样的错误。 请问楼上的,怎么加判断?
发表于 2010-11-12 10:00:24 | 显示全部楼层
代码有问题 ,优化代码就好了 仔细想想 我的也出现过这样的问题 把没用代码去掉或换其他的函数试试
发表于 2010-11-12 10:02:13 | 显示全部楼层
可以尝试这样写
#include <IE.au3>
dim $a="用户名",$b="密码"
$oIE = _IECreate ("http://reg.163.com/login.jsp")
$oForm = _IEFormGetObjByName ($oIE, "fLogin")
$ming = _IEFormElementGetObjByName ($oForm, "username")
$mima = _IEFormElementGetObjByName ($oForm, "password")
$an = _IEFormElementGetObjByName ($oForm, "Submit")
_IEFormElementSetValue ($ming, $a,0)
_IEFormElementSetValue ($mima, $b,0)
_IEAction ($an, "click")
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-18 12:29 , Processed in 0.093787 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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