Board logo

标题: [问题求助] VBS或批处理怎样实现网页自动登录? [打印本页]

作者: dresu    时间: 2015-11-8 10:11     标题: VBS或批处理怎样实现网页自动登录?

开启IE ,然后网页自动登录 谢谢各位! 见图片  vbs或批处理或按键精灵都可以 谢谢了
作者: dresu    时间: 2015-11-8 10:12

要键入的是 前两个和最后一个 谢谢!
作者: yu2n    时间: 2015-11-8 22:48

贴上代码…
验证码你打算如何解决?
  1. url = "http://yu2n.sinaapp.com"  ' 要采集的网址
  2. Set objIE = CreateObject("InternetExplorer.Application")
  3. With objIE
  4.   ' Configure the IE window
  5.   .RegisterAsDropTarget = False
  6.   .statusbar = False : .toolbar  = False : .menubar   = False : .addressbar = False
  7.   .Resizable = False : .Visible = True : .Navigate(URL)
  8.   Do While .Busy Or .ReadyState <> 4 : WScript.Sleep 200 : Loop  ' 等待完全载入
  9.   .width = 600     : .height = 400   ' 宽度与高度
  10.   .left = .document.parentWindow.screen.width \ 2 - 300  ' 居中显示
  11.   .top  = .document.parentWindow.screen.height\ 2 - 200
  12.   ' Test for IE 7 - cannot remove 'chrome' in that version
  13.   nVersion  = CSng(replace(split(_
  14.           .document.parentWindow.navigator.appVersion, " ")(3)_
  15.           , ";", ""))
  16.   if nVersion < 7.0 Then .FullScreen = True
  17.   ' Create the body document
  18.   With .document
  19.   
  20.     .getElementById("corpVccId").focus()
  21.     .getElementById("corpVccId").value = "123456"
  22.     .getElementById("user_name").focus()
  23.     .getElementById("user_name").value = "yu2n"
  24.     .getElementById("password").focus()
  25.     .getElementById("password").value = "yu2n"
  26.     .getElementById("cin_verifyCode").focus()
  27.     .getElementById("cin_verifyCode").value = InputBox("请输入验证码:", WScript.ScriptName, "yu2n")
  28.     .getElementById("corpVccId").disabled = True
  29.     .getElementById("user_name").disabled = True
  30.     .getElementById("password").disabled = True
  31.     .getElementById("cin_verifyCode").disabled = True
  32.    
  33.     WScript.Sleep 1000
  34.    
  35. REM 登陆按钮1
  36.     REM .getElementById("Button").focus()
  37.     REM .getElementById("Button").click()
  38.     REM 登陆按钮2
  39.     REM .getElementsBytagname("form1").submit
  40.     REM .forms(0).submit
  41.    
  42.     Do While objIE.Busy Or objIE.ReadyState <> 4 : WScript.Sleep 200 : Loop  ' 等待完全载入
  43.     .getElementById("Button").disabled = True
  44.     sHtml = .body.innerHTML  ' 将结果赋值给变量 str,以HTML格式返回数据
  45.    
  46.   End With
  47.   
  48.   WScript.Sleep 1000
  49.   .Visible = False
  50.   .quit
  51. End With
复制代码

作者: erjnasrtnws    时间: 2015-11-23 11:19

回复 3# yu2n


   GOOD
作者: 9zhmke    时间: 2015-12-23 11:26

验证码需要调用OCR组件,貌似十年前网上就可以搜到了,应该是有办法的。




欢迎光临 批处理之家 (http://bbs.bathome.net/) Powered by Discuz! 7.2