vb.net 在浏览器中提交方法

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14545701/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-17 12:02:54  来源:igfitidea点击:

Submit a method in webbrowser

vb.netmethodsbrowsersubmitinvokemember

提问by Haytham Mtair

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

这是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>

回答by Tomero Indonesia

You must set .AllowNavigation property to "TRUE"

您必须将 .AllowNavigation 属性设置为“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")