我有一個登錄到網站的腳本,可以在給定的時間間隔內快速自動點擊某些內容。自從我添加了我的最新細節之後,腳本中的所有內容都可以工作,除了自動刷新。一旦我點擊按鈕開始自動刷新,它甚至不會點擊一次。 這裏是我剛添加腳本無法正確自動點擊
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
什麼代碼所做的就是它會告訴你,如果你使用了正確的登錄憑據或那些錯誤的代碼。但我不明白這將如何影響我的autoclicking按鈕?
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
其中Timer1 =
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
檢查函數Timer1_Tick是否被調用,例如,把'MessageBox.Show'放在這個函數裏面。 – izogfif 2013-03-28 08:26:53
是的,我把消息框放在timer1中,然後點擊按鈕,它用一堆消息向我發送垃圾郵件。我似乎無法弄清楚爲什麼這不起作用,雖然... – 2013-03-28 08:49:40
元素與ID'claimIt'仍然在頁面上?它有會員'Click'嗎?這個成員真的是一個函數嗎?請檢查'Button1_Click_1'功能中的這些內容。 – izogfif 2013-03-28 08:50:47