I'm having the below code which works fine. The code is for typing some text on a website text field. In my case my site only have 2 components( it one TextBox, and one Button) the app simply loads this site and then auto type in the textbox field then automatically click the submit button. Now what I want is to wait for the respond because normally the site verifies the keys you entered then if the keys match one on database then its redirects you to homepage so what I want now is to get the response if the entered digit matched or not.
Here is the code I have to enter and submit data:
Dim usernameTextBox As HtmlElement = Me.WebBrowser1.Document.All.Item("SomeSiteTextHere") usernameTextBox.InnerText = "MyTextHere_ToBeAutoTyped" Dim elements = WebBrowser1.Document.GetElementsByTagName("input") For Each element As HtmlElement In elements If element.GetAttribute("className") = "button requires-tou" Then element.InvokeMember("click") Exit For End If
That's for auto typing and submitting. Now on my WebBrowser1_DocumentComplete I have the following, but first I first try to go to google that means upon giving or typing the matching text the site will redirect to http://www.google.com not on homepage.
Here's is my DocumentComplete code.
REM: First Im checking if the returned Url is of google or not, if its from google then I assume the text matched. If WebBrowser1.Url.Host.Contains("google.com") Then MsgBox("Matched") Else REM: That didnt match so try again. REM: Calling the function to auto type here. End If
Now this doesn't give time for verification, so what I want is that I want it to wait don't call the function to auto type if the response hasn't been completed. Normally its takes some few seconds maybe like 30 to 40 seconds the response or less let's say 20 Seconds for the sake of this post.
The problem is that my app even if you hard coded the matching texts (matches that on database) the app don't return it as a matching because I used the timer to fire the auto it function, buts that just too fast as in 3 seconds this function would have been called twice so I think the speed is to fast, I want it to wait for the response to complete before attempting to call this function again.
Anyone who can help me out here.