VBScript启动网站登录

时间:2013-01-08 18:45:15

标签: vbscript

我在网上找到了这个脚本,我编辑了大部分内容。

能够输入用户名和密码,但无法点击登录。

请帮我解决 这是登录论坛。

http://desistream.tv/en/index.shtml

这是脚本目前它在IE中,但我需要在Google Chrome中将其更改为开启。

WScript.Quit Main

Function Main
  Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
  IE.Visible = True
  IE.Navigate "http://desistream.tv/en/index.shtml"
  Wait IE
  With IE.Document
    .getElementByID("login_username").value = "myusername"
    .getElementByID("login_password").value = "mypassword"
    .getElementByID("form").submit
  End With
End Function

Sub Wait(IE)
  Do
    WScript.Sleep 500
  Loop While IE.ReadyState < 4 And IE.Busy 
  Do
    WScript.Sleep 500
  Loop While IE.ReadyState < 4 And IE.Busy 
End Sub

Sub IE_OnQuit
  On Error Resume Next
  WScript.StdErr.WriteLine "IE closed before script finished."
  WScript.Quit
End Sub

2 个答案:

答案 0 :(得分:3)

这是......

Call Main

Function Main
    Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
    IE.Visible = True
    IE.Navigate "http://desistream.tv/en/index.shtml"
    Wait IE
    With IE.Document
        .getElementByID("username").value = "myusername"
        .getElementByID("pass").value = "mypassword"
        .getElementsByName("frmLogin")(0).Submit
    End With
End Function

Sub Wait(IE)
  Do
    WScript.Sleep 500
  Loop While IE.ReadyState < 4 And IE.Busy
End Sub

答案 1 :(得分:1)

如果查看页面来源,您会看到实际的<form>标记名为frmLogin,而不是login