WebBrowser1.Document.GetElementsByTageName不返回任何结果

问题描述

我正在尝试登录网站https://connect.garmin.com/signin/,并使用VB.NET Webbrowser1自动完成用户名和密码。

我尝试将getElementsByID与'username'和'password'配合使用时没有运气。

我现在正尝试使用下面的代码列出页面上的元素,但没有返回任何结果。有什么想法吗?

Dim theElementCollection As HtmlElementCollection = Me.Webbrowser1.Document.GetElementsByTagName("input")

        For Each curElement As HtmlElement In theElementCollection

            Dim controlName As String = curElement.GetAttribute("name").ToString.toupper
            Console.WriteLine(controlName)
            If controlName.toupper = "USERNAME" Then

                curElement.SetAttribute("Value","davie")

            ElseIf controlName.toupper = "PASSWORD" Then

                curElement.SetAttribute("Value","genwells")
            End If
        Next

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)