0

我有一个代码不断在网站上声明用户名,因此当社交媒体决定发布这些用户名时,我将是第一个获得它的人。现在,它确实超时,这是一个大问题。所以要修复它,我试图让它退出帐户然后重新登录。

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

    If number_of_ticks > NumericUpDown1.Value Then
        WebBrowser1.Navigate("https://live.xbox.com/Account/Signout")
        While Not WebBrowser1.ReadyState = WebBrowserReadyState.Complete
            Application.DoEvents()
        End While
        WebBrowser1.Navigate("https://live.xbox.com/en-US/ChangeGamertag")

        WebBrowser1.Document.GetElementById("login").SetAttribute("value", txtUsername.Text)
        WebBrowser1.Document.GetElementById("passwd").SetAttribute("value", txtPassword.Text)
        WebBrowser1.Document.GetElementById("SI").InvokeMember("Click")
        number_of_ticks = 0
    End If

    If WebBrowser1.Url.ToString = "https://live.xbox.com/en-US/ChangeGamertag" Then
        WebBrowser1.Document.GetElementById("NewGamertag").SetAttribute("value", txtTurbo.Text)
        WebBrowser1.Document.GetElementById("claimIt").InvokeMember("Click")
        number_of_ticks += 1
    Else
    End If
End Sub

如您所见,在 number_of_ticks 达到某个数字后,我希望它导航到注销页面,然后在网页完全加载后,导航到另一个页面,它再次将信息放入以登录。不幸的是,这不起作用,当我尝试运行它时,我得到的只是错误。编码:

While Not WebBrowser1.ReadyState = WebBrowserReadyState.Complete
    Application.DoEvents()
End While

似乎根本不起作用,尤其是 WaitForPageLoad 等其他代码。我一直在寻找解决方案,但没有找到任何东西。

4

0 回答 0