【问题标题】:can't find error on my script在我的脚本上找不到错误
【发布时间】:2016-02-20 00:50:10
【问题描述】:

我有一个小的 VBScript,它可以打开一个网页并输入我的登录凭据。但是,我总是遇到错误,不知道如何解决。

Call Main

Function Main
    Set IE = WScript.CreateObject("InternetExplorer.Application", "IE_")
    IE.Visible = True
    IE.Navigate "https://x10hosting.com/sso/login"
    Wait IE
    With IE.Document
        .getElementByID("identifier").value = "FAKEEMAIL@my.com"
        .getElementByID("password").value = "FAKEPASS"
        .getElementsByName("button button-rounded button-primary")(0).Submit
    End With
End Function

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

错误是:

行:11
字符:9
错误:需要对象:'getElementsByName(...)(...)'
代码:800A01A8
来源:Microsoft VBScript 运行时错误

【问题讨论】:

  • @AnsgarWiechers 请看帖子。我当时编辑了

标签: login vbscript webpage


【解决方案1】:
With IE.Document
    .getElementByID("identifier").value = "FAKEEMAIL@my.com"
    .getElementByID("password").value = "FAKEPASS"
    .getElementsByName("button button-rounded button-primary")(0).Submit
End With

可能是因为您使用了错误的 getElementsByName 吗? getElementsByName 查找具有该名称的属性,但您似乎使用了类名。

Check this for getElementsByName

您需要使用 getElementsByClassName。

Check this for getElementsByClassName

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-22
    • 1970-01-01
    • 1970-01-01
    • 2012-03-06
    • 2020-07-11
    相关资源
    最近更新 更多