A program to automate the process of checking a set of UserIds passing as a input to a webform in a url and get the status using webbrowser . for Single Ids its working , but to automate for N number of ids, loop is not working but taking the last id and returns the output.
- private void button2_Click(object sender, EventArgs e)
- {
- string url = "https://www.verifyids.xhtml";
- WebBrowser b = new WebBrowser();
- b.ScriptErrorsSuppressed = true;
- b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted);
- b.Navigate(url);
- }
- private void b_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
- {
- for (int i = 0; i <= 4; i++)
- {
- WebBrowser b = sender as WebBrowser;
- b.Document.GetElementById("idnumber").InnerText = idarray[i];
- listobj = b.Document.GetElementsByTagName("select")[0].GetElementsByTagName("option")[1].SetAttribute("selected", "selected");
- response = b.DocumentText;
- b.Document.GetElementById("frmType1").SetAttribute("value", "24Q");
- HtmlElement btnlink = b.Document.GetElementById("clickGo1");
- btnlink.InvokeMember("Click");
- b.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted);
- b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_result);
- }
- enter code here
- }