views:

11

answers:

0

I want to get captcha from yahoo.com to show my form. I create a button with event click.

System.Net.WebClient wc = new System.Net.WebClient();
HtmlElementCollection imgs = this.webBrowser1.Document.GetElementsByTagName("img");
for (int i = 0; i < imgs.Count; i++)
{
      if(imgs[i].Id.Trim() == "cimg")
      wc.DownloadFile(imgs[i].GetAttribute("src"), "c:\\images" + i.ToString() + ".jpg");
}  

With this code. I can get image yahoo captcha save C partition. But when i set above code to DocumentCompleted events in Webbrowser then I can't get captcha. Who can everybody explain to me ? Thanks