Hi Guys,
I'm trying to login to a site via the webbrowser control, i can set the user/pass fields fine but the "Login" button doesnt have an id:
The basic code i am using is:
I cannot see what i'm doing wrong, any help would be appreciated guys!
cheers
Graham
EDIT:
Also tried:
It goes through the clicking motion but doesn't login, very strange.
I'm trying to login to a site via the webbrowser control, i can set the user/pass fields fine but the "Login" button doesnt have an id:
Code:
<div class="control-group">
<label class="control-label" for="inputLogin">Login:</label>
<div class="controls">
<input type="text" name="login" id="inputLogin">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Password:</label>
<div class="controls">
<input type="password" name="password" id="inputPassword">
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="submit" name="button_submit" class="btn" value="Login">
</div>
</div>
Code:
Dim login As HtmlElement = WebBrowser.Document.GetElementById("inputLogin")
login.InnerText = txtUser.Text
Dim password As HtmlElement = WebBrowser.Document.GetElementById("inputPassword")
password.InnerText = txtPass.Text
WebBrowser.Document.All("button_submit").InvokeMember("submit")
cheers
Graham
EDIT:
Also tried:
Code:
'// LOGGING IN
WebBrowser.AllowNavigation = True
WebBrowser.Navigate("http://www.expireddomains.net/login/")
Dim login As HtmlElement = WebBrowser.Document.GetElementById("inputLogin")
login.InnerText = txtUser.Text
Dim password As HtmlElement = WebBrowser.Document.GetElementById("inputPassword")
password.InnerText = txtPass.Text
For Each item As HtmlElement In WebBrowser.Document.GetElementsByTagName("input")
If item.OuterHtml.Contains("Login") Then
item.InvokeMember("click")
Exit For
End If
Next