title: "Specified cast is not valid" error
body: <p>I'm using this code which is meant to check the text in webBrowser1, although instead I'm getting the error "Specified cast is not valid." for <code>string docText = webBrowser1.Document.Body.InnerText;</code>. Any ideas why? Could it be because I'm accessing the webBrowser from another thread? Thanks.</p>
  
  <pre><code>public Form1()
  {
      InitializeComponent();
  }
  
  private void Form1_Load(object sender, EventArgs e)
  {
  }
  
  private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
  {
      string docText = webBrowser1.Document.Body.InnerText;
  
      if (docText == "Hello")
      {
          MessageBox.Show("Alerted!");
      }
  }
  
  private void timer1_Tick(object sender, EventArgs e)
  {
      backgroundWorker1.RunWorkerAsync();
  }
  </code></pre>