I have this code here in my program:
foreach (HtmlElement chat in wb.Document.GetElementsByTagName("input"))
{
if (chat != null)
{
if (chat.InnerText.Equals("Chat"))
{
chat.InvokeMember("Click");
loggedIn = true;
break;
}
}
}
Once it gets to the if(chat.InnerText.Equals("Chat"))
it throws a NullReferenceException Error as shown in the ScreenShot below:
Does anyone know why it is giving me that? I even put the if (chat != null)
code in there, and it still throws it.
This is the website code:
<div class="ContentTab">
Chat
</div>