我正在登录网站,但在检查登录是否成功时遇到问题,因为我已经在使用完成的文档。当我检查注销按钮是否存在时,页面还没有完成加载。这是我的代码:
Imports System.Net
Imports System.Text
Imports System.IO
Public Class Form1
Private Sub FutureButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FutureButton2.Click
If TextBox1.Text = ("") Or
TextBox2.Text = ("") Or
TextBox3.Text = ("") Or
TextBox4.Text = ("") Or
TextBox5.Text = ("") Or
TextBox6.Text = ("") Then
MsgBox("some information is Missing please Fill all The Boxes")
Else
WebBrowser1.Navigate("http://combatarms.nexon.net/Support/UserAbuse.aspx")
Form2.Show()
End If
End Sub
Private Sub WebBrowser2_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Dim Username, Password As String
Username = TextBox1.Text
Password = TextBox2.Text
Form2.FutureProgressBar1.Progress = 10
On Error Resume Next
WebBrowser1.Document.All("userID").SetAttribute("value", TextBox1.Text)
Form2.FutureProgressBar1.Progress = 20
WebBrowser1.Document.All("password").SetAttribute("value", TextBox2.Text)
Form2.FutureProgressBar1.Progress = 30
WebBrowser1.Document.All("gnt_login_submit").InvokeMember("click")
Form2.FutureProgressBar1.Progress = 40
If WebBrowser1.StatusText = ("Done") Then
If (WebBrowser1.Document.All("btnLogin") Is Nothing) Then
msgbox("Works")
else
MsgBox("wrong")
I have worked on it for days. The login is working but I can't get it to verify it.
Thanks for the help!