title: get all elements by tag name and invoke them in loop (C# webbrowser)
body: <pre><code>foreach(HTMLElement he in webBrowser.getElementByTagName("img"))
  {
      if(he.getAttribute("id").Contains("img"))
          he.InvokeMember("click");
      while(webBrowser.IsBusy)
          Application.DoEvents;
  }
  </code></pre>
  
  <p>this is code section in which I have problem.
  in first iteration htmlelement is invoked and corresponding page is loaded successfully but on invoking of second element it gives the following error:</p>
  
  <blockquote>
    <p>System.UnauthorizedAccessException: 'Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))'</p>
  </blockquote>
  
  <p>(Each element in loop is link to other page)</p>