我正在开发一个 vb.net 应用程序。我有一个网络浏览器,我需要在网络表单上填写一些信息并单击提交按钮。一切正常,除了提交,什么都没有发生!!!请帮忙 !
html页面:
<p>
<input id="submit" name="submit" type="submit" value="Publicar" />
</p>
我的代码:
Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
If PAgina = 0 Then
Dim document As HtmlDocument = WebBrowser1.Document
Dim inputValue As HtmlElement = document.GetElementById("title")
inputValue.SetAttribute("value", "sdf fdd fh fgh fgh fg hfg hf ghfgh fg fg f hf fgh ")
inputValue = document.GetElementById("zone")
inputValue.SetAttribute("value", "Logroño")
inputValue = document.GetElementById("editor")
inputValue.SetAttribute("value", "Logroño s dfs dfs fsdfsd fsddfg dfg df gdf gdf gd df sd sd fsd fsdfsdfsdsdfsdf sdsdf")
inputValue = document.GetElementById("email")
inputValue.SetAttribute("value", "dfgdgrankkk@gmail.com")
WebBrowser1.AllowNavigation = True
**Dim submitButton As HtmlElement = document.GetElementById("submit")
submitButton.InvokeMember("submit")
' WebBrowser1.Document.Forms("post").InvokeMember("submit")**
PAgina = 1
End If
结束子