Index OnIndia

Index OnIndia

  • NA
  • 15
  • 1.5k

Program to automate multiple ID (input)verification in URL

Jul 16 2019 12:14 AM
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.
  1. private void button2_Click(object sender, EventArgs e)  
  2. {  
  3. string url = "https://www.verifyids.xhtml";  
  4. WebBrowser b = new WebBrowser();  
  5. b.ScriptErrorsSuppressed = true;  
  6. b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted);  
  7. b.Navigate(url);  
  8. }  
  9. private void b_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)  
  10. {  
  11. for (int i = 0; i <= 4; i++)  
  12. {  
  13. WebBrowser b = sender as WebBrowser;  
  14. b.Document.GetElementById("idnumber").InnerText = idarray[i]; //string  
  15. listobj = b.Document.GetElementsByTagName("select")[0].GetElementsByTagName("option")[1].SetAttribute("selected""selected"); // string  
  16. response = b.DocumentText;  
  17. b.Document.GetElementById("frmType1").SetAttribute("value""24Q");  
  18. HtmlElement btnlink = b.Document.GetElementById("clickGo1");  
  19. btnlink.InvokeMember("Click");  
  20. b.DocumentCompleted -= new WebBrowserDocumentCompletedEventHandler(b_DocumentCompleted);  
  21. b.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(b_result);  
  22. }  
  23. enter code here  
  24. }