标题: [问题求助] VBS或批处理怎样实现网页自动登录? [打印本页]
作者: dresu 时间: 2015-11-8 10:11 标题: VBS或批处理怎样实现网页自动登录?
开启IE ,然后网页自动登录 谢谢各位! 见图片 vbs或批处理或按键精灵都可以 谢谢了
作者: dresu 时间: 2015-11-8 10:12
要键入的是 前两个和最后一个 谢谢!
作者: yu2n 时间: 2015-11-8 22:48
贴上代码…
验证码你打算如何解决?- url = "http://yu2n.sinaapp.com" ' 要采集的网址
- Set objIE = CreateObject("InternetExplorer.Application")
- With objIE
- ' Configure the IE window
- .RegisterAsDropTarget = False
- .statusbar = False : .toolbar = False : .menubar = False : .addressbar = False
- .Resizable = False : .Visible = True : .Navigate(URL)
- Do While .Busy Or .ReadyState <> 4 : WScript.Sleep 200 : Loop ' 等待完全载入
- .width = 600 : .height = 400 ' 宽度与高度
- .left = .document.parentWindow.screen.width \ 2 - 300 ' 居中显示
- .top = .document.parentWindow.screen.height\ 2 - 200
-
- ' Test for IE 7 - cannot remove 'chrome' in that version
- nVersion = CSng(replace(split(_
- .document.parentWindow.navigator.appVersion, " ")(3)_
- , ";", ""))
- if nVersion < 7.0 Then .FullScreen = True
-
- ' Create the body document
- With .document
-
- .getElementById("corpVccId").focus()
- .getElementById("corpVccId").value = "123456"
-
- .getElementById("user_name").focus()
- .getElementById("user_name").value = "yu2n"
-
- .getElementById("password").focus()
- .getElementById("password").value = "yu2n"
-
- .getElementById("cin_verifyCode").focus()
- .getElementById("cin_verifyCode").value = InputBox("请输入验证码:", WScript.ScriptName, "yu2n")
-
- .getElementById("corpVccId").disabled = True
- .getElementById("user_name").disabled = True
- .getElementById("password").disabled = True
- .getElementById("cin_verifyCode").disabled = True
-
- WScript.Sleep 1000
-
- REM 登陆按钮1
- REM .getElementById("Button").focus()
- REM .getElementById("Button").click()
-
- REM 登陆按钮2
- REM .getElementsBytagname("form1").submit
- REM .forms(0).submit
-
- Do While objIE.Busy Or objIE.ReadyState <> 4 : WScript.Sleep 200 : Loop ' 等待完全载入
- .getElementById("Button").disabled = True
- sHtml = .body.innerHTML ' 将结果赋值给变量 str,以HTML格式返回数据
-
- End With
-
- WScript.Sleep 1000
-
- .Visible = False
- .quit
- End With
复制代码
作者: erjnasrtnws 时间: 2015-11-23 11:19
回复 3# yu2n
GOOD
作者: 9zhmke 时间: 2015-12-23 11:26
验证码需要调用OCR组件,貌似十年前网上就可以搜到了,应该是有办法的。
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |