Submit a method in webbrowser

Haytham Mtair picture Haytham Mtair · Jan 27, 2013 · Viewed 11.1k times · Source

I have a problem invoking a submit method in web page

This is my code

Webbrowser.document.forms(0).invokemember("submit")

It does nothing.

Here is the html

<form name="myWebForm" action="myServerSideScript.php" method="post"> 
    <input type="checkbox" /> Checkbox 1<br /> 
    <input type="text" /> Text Field 1<br /> 
    <input type="submit" value="SUBMIT" /> 
</form>

Answer

Tomero Indonesia picture Tomero Indonesia · Mar 17, 2013

You must set .AllowNavigation property to "TRUE"

Webbrowser.AllowNavigation = True

And call submit method like this

Webbrowser.Document.Forms(0).InvokeMember("submit")

Or

Webbrowser.Document.Forms.GetElementsByName("myWebForm").Item(0).InvokeMember("submit")