Search code examples
vb.netgeckofx

How do I invoke a click event with GeckoFx?


I can't seem to invoke a click event in GeckoFX in vb.net. Here is my code:

Imports Skybound.Gecko
Public Class Form1


    Sub New()

        InitializeComponent()
        Xpcom.Initialize(Environment.CurrentDirectory + "/xulrunner")

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        GeckoWebBrowser1.Navigate("https://www.google.com")
        Dim Button = New GeckoButtonElement(_webBrowser.Document.getElementById("Search").DomObject)
    End Sub
End Class

The problem is that it says I do not have GeckoButtonElement class. I followed this tutorial.

Can someone help me get this button to click in another way? Or is there something else I have to do?

Side question: is there a package with the latest geckofx + xulrunner for download somewhere? I can't seem to find anything newer than what was offered in the tutorial above (which is from 2012).

Thanks.


Solution

  • Dim button As Gecko.DOM.GeckoButtonElement = TryCast(_webBrowser.Document.GetElementById("Search"), Gecko.DOM.GeckoButtonElement)
    If button IsNot Nothing Then
        button.Click()
    End If
    

    Newer versions of GeckoFx available on https://bitbucket.org/geckofx

    Latest version is GeckoFx 29.0 (https://bitbucket.org/geckofx/geckofx-29.0/downloads).