Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27193

VS 2010 [RESOLVED] Webbrowser not clicking login

$
0
0
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:

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>

The basic code i am using is:

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

I cannot see what i'm doing wrong, any help would be appreciated guys!

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

It goes through the clicking motion but doesn't login, very strange.

Viewing all articles
Browse latest Browse all 27193


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>