I am working on web crawler in which it checks the results of students from same website. I am able to submit the form and select elements but the problem is that i want to use web browser control in a loop.
for (int i = 3910001; i < 391537; i++)
{
webBrowser1.Navigate(url);
}
Basically i want to navigate to url and submit the form and pick some elements from the returned HTml
. So i used webBrowser1_DocumentCompleted
.
private void webBrowser1_DocumentCompleted(object sender,
WebBrowserDocumentCompletedEventArgs e)
{
// MessageBox.Show("I am in completed");
HtmlElement form = webBrowser1.Document.GetElementById("form1");
webBrowser1.Document.GetElementById("RollNo").SetAttribute("value", "100");
HtmlElement btn = webBrowser1.Document.GetElementById("Submit");
btn.InvokeMember("click");
}
I want to finish one document then move to other but the problem is that first the loop completes then in the end webBrowser1_DocumentCompleted
is called only once.
Is there a solution to this problem?
Thanks