Submit web form on a GeckoWebBrowser? (GeckoFX)

ElektroStudios picture ElektroStudios · Dec 24, 2013 · Viewed 8.3k times · Source

There is a properly way to submit a web form using GeckoFX library?

This is what I'm doing to fill a web form and submit the form, but...well, I'm not submitting, I'm just clicking on the last button of the page and I think that can't be the properly way to do it...

Framework's WebBrowser control has a method to submit a web form but I can't find any similar method to properly submit a web form on a GeckWebBrowser.

Dim doc = GeckoWebBrowser1.Document

doc.GetElementById("id_username").
    SetAttribute("value", CStr(MyUsername))

doc.GetElementById("id_password").
    SetAttribute("value", CStr(MyPassword))

doc.GetElementsByTagName("input").
    Last.Click()

Answer

Tom picture Tom · Dec 25, 2013

The GeckoFormElement has a submit method.

So something like this:

(GetElementByTagName("form").First() as GeckoFormElement).submit()