vbscript网页模拟登录效果代码(用vb编写登录界面代码)满满干货

随心笔谈2年前发布 admin
198 0 0

文章摘要

这篇文章介绍了一段使用Visual Basic脚本实现的CMCC-EDU网站自动登录功能。代码通过创建COM对象(如`wscript.Shell`、`scripting.filesystemobject`和`InternetExplorer.Application`)来操作网页,实现了从文本文件读取用户名和密码后,自动导航到目标网站并完成登录操作。核心内容是通过自动化技术简化手动登录流程。


‘自动登录CMCC-EDU
‘By:Seven 2014/2/25
On Error Resume Next
Set WshShell=CreateObject(“wscript.Shell”)
Set fso=CreateObject(“scripting.filesystemobject”)
Set ie=CreateObject(“InternetExplorer.Application”)
Set list=fso.OpenTextFile(“帐号.txt”)
ie.Visible=1
ie.Navigate “www.baidu.com”
Do Until ie.ReadyState=4 : WScript.Sleep 200 : Loop
ie.document.getElementByIdx_x(“bpssUSERNAME”).Value=List.ReadLine
ie.document.getElementByIdx_x(“bpssBUSPWD”).Value=List.ReadLine
Set AllElement=ie.Document
For i=0 To AllElement.all.length-1
if AllElement.all(i).tagname=”INPUT” Then
if AllElement.all(i).value=”登录” Then
AllElement.all(i).click
End If
End if
Next

© 版权声明

相关文章