0

This is the code:

public void WebBrowser wb;
public void Login(){
    wb.Navigate("http://mywebsite.com/login.php");
    wb.DocumentCompleted+=(o,e) => {
        if (wb.ReadyState != WebBrowserReadyState.Complete) return;

        var inputs = wb.Document.GetElementsByTagName("input");
        inputs["username"].SetAttribute("value",account.Username);
        inputs["password"].SetAttribute("value",account.Password);
        if (wb.Document.Forms.Count==0) return;
        wb.Document.Forms[0].InvokeMember("submit");
    };
}

The WebBrowser navigates to the website, and fills out the form correctly.
But it doesn't submit?

Why?

SmRndGuy
  • 1,719
  • 5
  • 30
  • 49
  • this may help http://stackoverflow.com/questions/2299273/how-do-i-submit-a-form-inside-a-webbrowser-control – Bit Jan 15 '14 at 20:10

1 Answers1

-1

Do you have a submit button? Try invoking the click event directly on it.

Here's a link where the requester Invokes the click on the inputs, maybe it will guide you.

Hope I helped you

InvokeMember("click")