Login web

Amicone

New member
Joined
Feb 19, 2012
Messages
1
Programming Experience
5-10
Hello everyone I wanted to show this code vb.net, and I wanted to know if it was possible to improve this code .... thanks for your attention.

VB.NET:
Private Sub Login()


        Dim appIE As New SHDocVw.InternetExplorer


        With appIE
            .Visible = True
            .Navigate("http://www.unetenet.com/")


            Do
                Application.DoEvents()
            Loop Until appIE.ReadyState = WebBrowserReadyState.Complete
            wait(2000)
        End With




        Dim HTMLDocument As mshtml.HTMLDocument
        Dim HTMLLinK As mshtml.HTMLAnchorElement
        Dim curElement As Object
        Dim theElementCollection As mshtml.IHTMLElementCollection


        HTMLDocument = TryCast(appIE.Document, mshtml.HTMLDocument)
        HTMLLinK = TryCast(HTMLDocument.links, mshtml.HTMLAnchorElement)
        curElement = TryCast(HTMLDocument.documentElement, Object)
        theElementCollection = TryCast(HTMLDocument.getElementsByTagName("Input"), mshtml.IHTMLElementCollection)


        'inserisci credenziali
        For Each curElement In theElementCollection
            Dim UserName As String = curElement.GetAttribute("name").ToString
            Dim Password As String = curElement.GetAttribute("name").ToString


            If UserName = "username" Then
                curElement.SetAttribute("Value", "user")
            ElseIf Password = "password" Then
                curElement.setAttribute("Value", "password")
            End If
        Next


        'submit
        HTMLDocument.forms(1).submit()


        Do
            Application.DoEvents()
        Loop Until appIE.ReadyState = WebBrowserReadyState.Complete


        wait(5000)


        For Each HTMLLinK In HTMLDocument.links
            If HTMLLinK.innerText = "Anuncios" Then
                appIE.Navigate(HTMLLinK.getAttribute("href"))
                Exit For
            End If
        Next


    End Sub
 

dopoj0npen

New member
Joined
Nov 25, 2013
Messages
1
Programming Experience
Beginner
it is code for login on web base ??
can i ask you,
can you teach me, to making a program use vb.net , i join this forum, cause i want learn much ,about vb .net,

thanks
 
Top Bottom