title: Click an HTML link inside a WebBrowser Control
body: <p>C#  Visual Studio 2010</p>
  
  <p>I am loading a complex html page into a webbrowser control.  But, I don't have the ability to modify the webpage.  I want to click a link on the page automatically from the windows form.  But, the ID appears to be randomly generated each time the page is loaded (so I believe referencing the ID will not work).</p>
  
  <p>This is the content of the a href link:</p>
  
  <pre><code>&lt;a 
  </code></pre>
  
  <p><code>id="u_lp_id_58547" 
  href="javascript:void(0)" 
  class="SGLeftPanelText" onclick="setStoreParams('cases;212', 212); window.leftpanel.onClick('cases_ss_733');return false; "&gt;</code></p>
  
  <pre><code>My Assigned&lt;/a&gt;
  </code></pre>
  
  <p>Is the anyway to click the link from C#?</p>
  
  <p>Thanks!</p>
  
  <hr>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I feel like this is close but it is just not working:</p>
  
  <pre><code>HtmlElementCollection links = helpdeskWebBrowser.Document.Window.Frames["main_pending_events_frame"].Document.GetElementsByTagName("a");
  MessageBox.Show(links.Count.ToString());
  </code></pre>
  
  <p>I have tried plugging in every single frame name and tried both "a" and "A" in the TagName field but just have not had any luck.  I can just not find any links; the message box is always 0.  What am I missing?</p>