none
Auto Fill username and password

    Question

  • Hello guys!

    I want to autofill the username and password field by my vb program. My Program contains webbrowser control
    and needs to autofill and invoke the signin button.

    I already have the experience with autologin of gmail,yahoo... But here my problem is i cant find the tag name or name of the field which i want to fill the value...

    Here the url which i want to autofill : http://webuzz.im/mail/

    Its just look like gadget something, how to do? any help would be appreciated!

    Advance thanks
    Wednesday, February 17, 2010 2:26 PM

All replies

  • Hello

    For you to auto fill something you have to use the AutoCompleteStringCollection(). I just gonna past here a very simple E.G and you can change it as you want, for your username and password

     Private Sub AutFill_Load()
            Dim collection As New AutoCompleteStringCollection()
            ' //creat auto complete Collection 
            '        Dim collection As AutoCompleteStringCollection = New AutoCompleteStringCollection()
            '//Connection String 
            Dim CNET As String = "Data Source=LEVI-PC\SQLEXPRESS;Initial Catalog=Teste_One;Integrated Security=True"
            '//creating connection String
            Using MYquery As New SqlConnection(sStrin)
                MYquery.Open()
                Dim fillme As New SqlDataAdapter(New SqlCommand("Select * From Table_Inf", MYquery))
                Dim TT As New DataTable
                fillme.Fill(TT)

                If TT.Rows.Count > 0 Then
                    For i As Integer = 0 To TT.Rows.Count - 1
                        collection.Add(TT.Rows(i).ItemArray(0).ToString())
                    Next

                End If

                Me.TextBox1.AutoCompleteMode = AutoCompleteMode.Suggest
                Me.TextBox1.AutoCompleteSource = AutoCompleteSource.CustomSource
                TextBox1.AutoCompleteCustomSource = collection
            End Using

        End Sub

    Just Be Humble Malange!
    Wednesday, February 17, 2010 6:13 PM
  • It looks like some sort of JavaScript control or component. I don't know how you could autofill those fields since they don't appear to show up in the source.

    If there was a shortcut key to the Email field I would suggest sending keystrokes but I don't even see way to reliably do this.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Wednesday, February 17, 2010 7:14 PM
  • It looks like some sort of JavaScript control or component. I don't know how you could autofill those fields since they don't appear to show up in the source.

    If there was a shortcut key to the Email field I would suggest sending keystrokes but I don't even see way to reliably do this.
    Paul ~~~~ Microsoft MVP (Visual Basic)

    It doenn't appear in the source, thats the problem.... how to move on now...
    Thursday, February 18, 2010 12:51 PM
  • If you want to move on then, there is a property  All() of the HtmlElement which gets all the HtmlElement under the CurrentElement.

    Dim theElement As HtmlElement
            theElement = WebBrowser1.Document.GetElementById("login-box")
            Dim theElementcollection As HtmlElementCollection = theElement.All
    

    Asgar
    Thursday, February 18, 2010 8:46 PM
  • If you want to move on then, there is a property  All() of the HtmlElement which gets all the HtmlElement under the CurrentElement.

    Dim theElement As HtmlElement
            theElement = WebBrowser1.Document.GetElementById("login-box")
            Dim theElementcollection As HtmlElementCollection = theElement.All
    
    

    Asgar
    I can fill the boxes like
    vb Code:
    1. wb.Navigate2 ("http://webuzz.im/mail")
    2. Do Until wb.readystate = 4
    3. DoEvents
    4. Loop
    5. Set ele = wb.document.getelementbyid("login-box").document.getelementsbytagname("input")
    6. ele(0).Value = "pete"
    7. ele(1).Value = "password"
    but filling them by code does not run the javascript to enable the sign in button
    I can click the button like
    vb Code:
    1. Set ele = wb.document.getelementbyid("login-box").document.getelementsbytagname("button")
    2. ele(2).Click
    but this will do nothing until the button is enabled!

    Is it any other way to enable the sign in button while form loading???
    Saturday, February 20, 2010 10:08 AM
  • I think the button is enabled in keyup event, so try raising the event after setting ele(0) and ele(1)'s value

     ele(0).RaiseEvent("onkeyup")

    Arjun Paudel
    Saturday, February 20, 2010 11:02 AM
  • Guys thanks for the support i resolved it in another way...

    Once again thanks to all

    • Proposed as answer by _asgar Thursday, March 04, 2010 1:52 PM
    Thursday, March 04, 2010 11:38 AM
  • Guys thanks for the support i resolved it in another way...

    Once again thanks to all


    Why is that an answer? another way!! whats that?
    Arjun Paudel
    Thursday, March 04, 2010 5:55 PM
  • Yes it would have helped if the OP had posted his solution, otherwise the proposed answer isn't very useful.
    Paul ~~~~ Microsoft MVP (Visual Basic)
    Thursday, March 04, 2010 6:33 PM
  • That's pretty easy.

    First, you need to install the Firebug Extension (For Firefox & googleChrome)

    Next, Start FireBug

    Click on Inspect, and then move your mouse over the Username / Password TextBox.

    There should be <input type="textbox" id="username" value = "">  <<<something like this

    Remember the ID

    next, goto your VB and put this code in :

    WebBrowser1.Document.GetElementById("TheIDyouGotJustNow").SetAttribute("value", PresetUsername.Text)
    

    *Put this code in WebBrowser1_DocumentComplete (Make sure the webpage is loaded completely.

    • Proposed as answer by AndyLun2009 Monday, May 28, 2012 7:31 AM
    • Edited by AndyLun2009 Monday, May 28, 2012 7:32 AM
    Monday, May 28, 2012 7:31 AM