Auto login form with Visual Basic

前端 未结 2 1430
庸人自扰
庸人自扰 2021-01-17 06:50

I need make an auto login form application with Visual Basic 10.0 for the following code:


    

        
相关标签:
2条回答
  • 2021-01-17 07:14

    Try this:

    If Not String.IsNullOrEmpty(My.Settings.Username) And Not String.IsNullOrEmpty(My.Settings.Password) Then
            TxtUsername.Text = My.Settings.Username
            TxtPassword.Text = My.Settings.Password
    End If
    
    0 讨论(0)
  • 2021-01-17 07:18

    You first need to take all the elements that you want to interact to. If they have an ID, you don't need to search, simply get the element with:

    Dim elem As HtmlElement = Webbrowser1.Document.GetElementById("myId")
    

    If not, you need to search for yours, for example:

    Dim inputs As New List(Of HtmlElement)(a.Document.GetElementsByTagName("input"))
    
    For Each elem As HtmlElement In inputs
        If elem.GetAttribute("name").Equals("uid") Then
            '...
        End If
    Next
    

    To set a value of a input:

    elem.SetAttributte("value", passwordVar)
    

    To click a clickable element (such a submit input):

    elem.InvokeMember("submit")
    

    Or:

    elem.InvokeMember("click")
    
    0 讨论(0)
提交回复
热议问题