title: Specified cast is not valid. C# WebBrowser
body: <pre><code>url="https://ipv4.google.com/sorry/IndexRedirect?continue=https://www.google.com/search%3Fq%3Dstackoverflow%2B%26rlz%3D1C1KMZB_enTR561TR561%26oq%3Dstac%26aqs%3Dchrome.1.69i59l3j69i60j69i57j69i60.5208j0j7%26sourceid%3Dchrome%26espv%3D210%26es_sm%3D122%26ie%3DUTF-8";
  
  webBrowser1.Navigate(url);
  
  if (url.Contains("ipv4.google.com"))
  {
      frm2.ShowDialog();
      Application.DoEvents();
      webBrowser1.Document.GetElementById("captcha").SetAttribute("value", frm2.code);
      webBrowser1.Document.GetElementById("submit").InvokeMember("click");
  }
  </code></pre>
  
  <p>Exception is:</p>
  
  <blockquote>
    <p>Specified cast is not valid.</p>
  </blockquote>
  
  <p>at</p>
  
  <pre><code>webBrowser1.Document.GetElementById("captcha").SetAttribute("value", frm2.code);
  </code></pre>