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?
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.
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.
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.
Use the <noscript></noscript> tags to define a "normal" submit-button when javascript is disabled.
Try this (or something like it):
HtmlElementCollection elements = this.webBrowserControl.Document.GetElementsByTagName("Form");
foreach(HtmlElement currentElement in elements)
{
currentElement.InvokeMember("submit");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With