Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How programmatically submit a form without a submit button in WebBrowser

I navigated to a website with a form that has no submit button but does have form. I would like to submit this form. How to do this using C# and WebBrowser control?

like image 372
Tom Smykowski Avatar asked Oct 08 '09 18:10

Tom Smykowski


People also ask

How can submit form without click submit button?

The form can be submitted without using submit button by implementing a specific event attribute or by clicking the link. This task can be done by using the OnClick event attribute or by using the form. submit() method in Javascript.

How do I submit a Google form without a submit button?

There is not an option to remove the Submit Button; however, you can choose to hide it on the Form if you'd like, making the "Form" an informational web page/landing page rather than a page that requires/expects action.

Does a form require a submit button?

If you don't have any submit button it is acceptable after all it is an element of form tag and if it is not required you may not add it with in form . This will not broke any web standard.

How can I submit a form without using JavaScript?

Use the <noscript></noscript> tags to define a "normal" submit-button when javascript is disabled.


1 Answers

Try this (or something like it):

HtmlElementCollection elements = this.webBrowserControl.Document.GetElementsByTagName("Form");  

foreach(HtmlElement currentElement in elements)
{
    currentElement.InvokeMember("submit");
}
like image 195
Cam Soper Avatar answered Sep 23 '22 14:09

Cam Soper