In constructor:
webBrowser2.Navigate("http://www.tapuz.co.il/forums/forumpage/393");
Then in DocumentCompleted:
void webBrowser2_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlElementCollection items = this.webBrowser1.Document.GetElementsByTagName("span");
foreach (HtmlElement item in items)
{
if (item.GetAttribute("className") == "addMessage")
{
item.InvokeMember("click");
break;
}
}
}
I'm getting on
HtmlElementCollection items = this.webBrowser1.Document.GetElementsByTagName("span");
Null exception.
I tried to add before this line a loop:
while (webBrowser2.ReadyState != WebBrowserReadyState.Complete)
{
return;
}
But then it didn't do anything when the page loaded. It's never got to to the next lines. I just saw the page loading in the webBrowser.