4

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

它可以在其下输入用户名和密码,但无法单击登录。

请帮我修复 这里是登录论坛。

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
4

2 回答 2

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
于 2013-01-08T19:01:26.757 回答
1

如果您查看页面源代码,您会看到实际的<form>标签被称为frmLogin,而不是login

于 2013-01-08T18:47:52.320 回答