title: WebBrowser control not responding to InvokeMember("click")
body: <p>After spending 5 days of my life, I'm about to give up on this, but am consulting the experts once before that.</p>
  
  <p>I have a WebBrowser control that loads a webpage and I programmatically scrape its contents. Clicking a particular menu item in the page brings up File Open dialog when done in IE (or any other browser). But clicking the same button in WebBrowser control using <code>InvokeMember()</code> apparently doesn't do anything no matter what. I've gone through several SO questions such as <a href="https://stackoverflow.com/questions/18333459/c-sharp-webbrowser-ajax-call">Setting Browser Features</a> to make sure my control behaves exactly like IE, but that hasn't succeeded.</p>
  
  <p>I went as far as inspecting the actual javascript function that the button is executing behind the scene and calling it manually using <code>HtmlDocument.InvokeScript()</code> but couldn't do that because the underlying function takes an argument of <code>MouseEvent</code> type (the click event actually) and I'm not sure how can I create that object in C#. </p>
  
  <p>Another approach was to set focus to that particular button and then try <code>SendKeys</code>, but that won't work because the WebBrowser control is not visible. It is just an in-memory instance. To be more specific, the WebBrowser</p>
  
  <h2>EDIT</h2>
  
  <p>On a reader's request, here's the simple code that I'm using to find the element:</p>
  
  <pre><code>var MyButton = WB.Document.GetElementById("processfilelink");
  </code></pre>
  
  <p><code>processfilelink</code> is an anchor tag (<code>&lt;a href='#' ... &gt;</code>) and I have confirmed that this element actually exists in the body of the document. The webpage uses jQuery's <code>delegate</code> feature to bind this anchor's <code>click</code> event to the target function. After locating the button, I simply call <code>InvokeMember()</code> like this:</p>
  
  <pre><code>MyButton.InvokeMember("click");
  </code></pre>
  
  <p>Note: I also see bindings for mousedown, mouseup and focus events in the page code. I expect all these events to automatically fire when one invokes <code>click</code>, but just to be sure I added <code>InvokeMember</code> calls for these events too. Results are no better.</p>