Login with webbrowser Problem
Good evening together.
I want to log on the web page on http://108.hosttech.ch/user/index.php
the web browser. This is usually not a problem but I can not get the login button automatically vers / click
So far I have this;
Code:
WebBrowser1.Document.All ("user name"). SetAttribute ("value", "***********")
WebBrowser1.Document.All ("password"). SetAttribute ("value", "************")
WebBrowser1.Document.GetElementById ("?? Name ??"). InvokeMember (" click ")
Thanks for the help
Re: Login with webbrowser Problem
try this:
vb Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.Navigate("http://108.hosttech.ch/user/index.php")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser1.Document.All.GetElementsByName("username")(0).SetAttribute("value", "username")
WebBrowser1.Document.All.GetElementsByName("password")(0).SetAttribute("value", "password")
For Each element As HtmlElement In WebBrowser1.Document.GetElementsByTagName("a")
If element.GetAttribute("className") = "button-1" Then
element.InvokeMember("click")
Return
End If
Next
End Sub
End Class