Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
315 views
in Technique[技术] by (71.8m points)

vb.net - Submit a method in webbrowser

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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...