Logging into a website using c#
<p>I am trying to log into a website using the webbrowser class, here is what I did:</p>

<pre><code>        //Fetch the username input
        HtmlElement usernameElement = Utilites.extractElementFromBrowserByName("user", browser);
        usernameElement.SetAttribute("value", userName);

        //Fetch the email input
        HtmlElement emailElement = Utilites.extractElementFromBrowserByName("email", browser);
        emailElement.SetAttribute("value", userEmail);

        //Fetch the submit buttom
        HtmlElement submitElement = Utilites.extractElementFromBrowserByValue("Login Action", browser);
        submitElement.InvokeMember("submit"); //Simulates a click on the login button

        browser.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(getMe);
</code></pre>

<p>I fetched the elements and filled them, then found the submit button and clicked it. I then subscribed to the document loaded event, but this event is never fired.</p>

<p>Did I do something wrong?</p>

<p>Thanks.</p>

<p>Edit: I already tried submitElement.InvokeMember("click"), still didn't work.</p>
