后台自动登录网页vb脚本实例代码

set IE=createobject("Internetexplorer.application")
IE.Visible = True
IE.Navigate "https://www.xxx.com/login.htm"

‘等待网页加载完成
While IE.busy Or IE.readystate<>4
Wend

'从网页元素中找到设置的元素,并赋值
'因为form没有name或id,只能从document的collection里取forms集合
'再从中定位输入框和提交按钮
IE.Document.Forms(0).elements("name").value = "aaaa"
IE.Document.Forms(0).elements("passwd").value = "1111"
IE.Document.Forms(0).elements("Send").click

'登录后界面是框架结构,先等主框架加载完成
While IE.busy Or IE.readystate<>4
Wend

'等框架内网页1加载完成
While IE.busy Or IE.Document.Frames(1).document.readystate<>"complete"
Wend


'点击一个图片按钮/链接,需要先定位到框架内,再从document的collection里取images集合
IE.Document.Frames(1).document.images(3).click

'等主框架加载完成

While IE.busy Or IE.readystate<>4

Wend

'等框架内网页2加载完成
While IE.busy Or IE.Document.Frames(2).document.readystate<>"complete"
Wend

'定位select控件,并作出选择
IE.Document.Frames(2).document.Forms(0).elements("lst_ed_day").selectedIndex=8
IE.Document.Frames(2).document.Forms(0).elements("lst_st_time").selectedIndex=1

'其他操作。。。。

=======================================================

html元素属性可以参阅http://msdn.microsoft.com/en-us/library/ms533050(vs.85).aspx

InternetExplorer Object可参阅:http://msdn.microsoft.com/en-us/library/aa752084(VS.85).aspx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值