Login to Hotmail using WebBowser control
i'm trying to login to Hotmail using the WebBrowser control. the problem is as i get the document compl开发者_运维百科eted event, and call:
HtmlElement elementsByTagName = webBrowser1.Document.GetElementById("signInTD");
or
HtmlElementCollection elementsByTagName = webBrowser1.Document.GetElementsByTagName("input");
i get nulls. i've tried using HtmlAgillity Pack, and still i get the same result. i know it used to work in the past as i`ve seen samples doing the same thing with the same code.
webBrowser1.DocumentCompleted += webBrowser1_DocumentCompleted;
void webBrowser1_DocumentCompleted (object sender, EventArgs e)
{
IEnumerable<HtmlElement> inputs = webBrowser1.Document.All
.OfType<HtmlElement>()
.Where(el => String.Equals(el.TagName, "input", StringComparison.OrdinalIgnoreCase));
}
精彩评论