title: Download a file on HTML button click using GeckoWebBrowser
body: <p>On a <strong>VB.NET</strong> project, using the <code>GeckoWebBrowser</code> control (v45.0.34.0), I am trying to <strong>download a file</strong> from a web page on html <strong>button click</strong>. I managed to load the page, find the button, but when my code "clicks" on it, I get nothing!!! Do I have to create any "extra" event for this? Isn't it work like <code>WebBrowser</code> control?</p>
  
  <pre><code>Imports Gecko
  
  Public Class Form1
  
      Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
          GeckoWebBrowser1.Navigate("http://mywebpage.com/download.html")
      End Sub
  
      Private Sub GeckoWebBrowser1_DocumentCompleted(sender As Object, e As Events.GeckoDocumentCompletedEventArgs) Handles GeckoWebBrowser1.DocumentCompleted
          Dim _Elements As GeckoElementCollection = GeckoWebBrowser1.Document.GetElementsByTagName("input")
          For Each _Element As GeckoHtmlElement In _Elements
              Dim _src As String = _Element.GetAttribute("src")
              Dim _value As String = _Element.GetAttribute("value")
              If _src IsNot Nothing AndAlso _src &lt;&gt; "" AndAlso _src.Contains("button-download.gif") Then
                  _Element.Click()
              ElseIf _value IsNot Nothing AndAlso _value &lt;&gt; "" AndAlso _value.Contains("Download") Then
                  _Element.Click()
          End If
          Next
      End Sub
  
  End Class
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>This is a part of the HTML code of the page that I am trying to integrate with. Note that if I do the same thing with .NET <code>WebBrowser</code> control, it works!!!</p>
  
  <pre><code>&lt;td&gt;
      &lt;div align="center"&gt;
          &lt;!--&lt;a rel="nofollow" href="getSub-tkMTUyMTgzNTIzMjQyNjI1MDYyNDI2Mjk2Mzk0OTg5.html" class="style55ws"&gt;&lt;img src="http://***.com/button-download.gif" alt="down" width="200" height="58" /&gt;&lt;/a&gt;--&gt;
          &lt;input type="hidden" name="id" value="tkMTUyMTgzNTIzMjQyNjI1MDYyNDI2Mjk2Mzk0OTg5"&gt;
          &lt;input type="image" src="http://***.com/button-download.gif" width="200px" height="58px" alt="submit"&gt;
      &lt;/div&gt;
  &lt;/td&gt;
  </code></pre>