Submit a method in webbrowser

谁都会走 提交于 2019-12-25 05:57:16

问题


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>

回答1:


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


来源:https://stackoverflow.com/questions/14545701/submit-a-method-in-webbrowser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!