日期:2014-05-17 浏览次数:20917 次
private void Form1_Load(object sender, EventArgs e)
{
this.wb.Url = new Uri("https://login.yahoo.com/config/login_verify2?.intl=gr&.src=ym");
this.wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
}
public void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlDocument doc = wb.Document;
HtmlElement goButton= doc.GetElementById("submit");
goButton.InvokeMember("click");
static IEnumerable<HtmlElement> ElementsByClass(HtmlDocument doc, string className)
{
foreach (HtmlElement e in doc.All)
if (e.GetAttribute("className") == className)
yield return e;
}