Question How To Determine Whether an Automated Form Submission Has Been Successful

quest2chill

Member
Joined
Mar 3, 2012
Messages
6
Programming Experience
Beginner
I have a process within my application that requires an automated submission of a registration form.

My current coding is working fine when there are no errors on the form submitted, but when form submission
fails due to errors on form my program loops and keeps submitting the same form obviously generating the same errors.

Q, Is there anyway I can check to see if the form submission has been successful or not?

Regards

VB.Net Code:


Private Sub webbrowser1_documentcompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
Try


WebBrowser1.Document.GetElementById("first_name").SetAttribute("value", "Joe")
WebBrowser1.Document.GetElementById("last_name").SetAttribute("value", "Bloggs")
WebBrowser1.Document.GetElementById("email").SetAttribute("value", "support@website.com")
WebBrowser1.Document.GetElementById("password").SetAttribute("value", "xklkai")
WebBrowser1.Document.GetElementById("retype_password").SetAttribute("value", "xklkai")
WebBrowser1.Document.GetElementById("question").SetAttribute("value", "0")
WebBrowser1.Document.GetElementById("answer").SetAttribute("value", "abcdef")


' The following line clicks the button successfully but then keeps clicking again and again when submission fails

WebBrowser1.Document.GetElementById("submit").InvokeMember("click")

Catch ex As System.NullReferenceException
Catch ex As Exception
' MessageBox.Show("Program fails with " & vbCrLf & ex.Message())
End Try


End Sub
 
Back
Top