I 'm developing a vb.net application. I have a webbrowser, and i need to fill some info on a webform and click submit button. All is ok except the submit, nothing happens !!! Please help !
The html page :
My Code :
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
end sub
The html page :
Code:
<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
end sub