Sunday 12 August 2012

log in using id in vb.net part 2



This tutorial is an extension of the previous tutorial which covered how to retrieve every HTML element in a web page. This tutorial will show you how to click a button that doesn’t have an ID.

Use this application is login facebook without using (open web browser) and modifies this application you can open facebook login in double clicking the application
·         As usual for navigating your application all you need web browser for that add web browser and for navigate enter address of login page and click go
·         Reading all html element and find element login then invoke the login element

Make this application all you nedd
1 we browser
1 Text box
1 button


Copy and paste below Code:

Public Class Form1
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        WebBrowser1.Navigate("http://login.facebook.com/login.php")
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim allelements As HtmlElementCollection = WebBrowser1.Document.All
        For Each webpageelement As HtmlElement In allelements
            If webpageelement.GetAttribute("value") = "Log In" Then
                webpageelement.InvokeMember("click")
 End If
 Next
 End Sub
End Class