我有一个脚本可以登录到一个网站,并且可以在给定的时间间隔内非常快速地自动点击一些东西。现在,自从我添加了最新的细节后,脚本中的所有内容都可以正常工作,除了自动点击器。一旦我点击按钮启动自动点击器,它甚至不会点击一次。这是我刚刚添加的代码
With WebBrowser1
Do Until Not (.IsBusy)
Application.DoEvents()
Loop
Do Until .ReadyState = WebBrowserReadyState.Complete
Application.DoEvents()
Loop
End With
Dim htmlText As String
If Not (WebBrowser1.Document.Body.InnerHtml) Is Nothing Then
htmlText = WebBrowser1.Document.Body.InnerHtml
If InStr(htmlText, "Microsoft account") Then
MessageBox.Show("You have entered in a wrong password or the account doesn't exist.")
'code to go here if it is true
Else
MessageBox.Show("Sign in successful. Proceed on...")
'code to go here if it is false
End If
End If
代码的作用是告诉您您使用了正确的登录凭据还是错误的凭据。但我不明白这会如何影响我的自动点击按钮?
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If RadioButton1.Checked = True Then
Timer1.Interval = 40
ElseIf RadioButton2.Checked = True Then
Timer1.Interval = 100
Else
Timer1.Interval = 500
End If
Timer1.Start()
WebBrowser1.Document.GetElementById("NewGamertag").SetAttribute("value", txtTurbo.Text)
WebBrowser1.Document.GetElementById("claimIt").InvokeMember("Click")
End Sub
其中计时器1 =
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
WebBrowser1.Document.GetElementById("claimIt").InvokeMember("Click")
End Sub