Help on Facebook Login in VB2008
Hello guys, i am now to this forum and i hope i can learn much about vb here =].
The problem i am stating today is that i want this program to log in to
facebook (https://login.facebook.com/login.php?login_attempt=1)
and after that, go to
mousehunt (http://apps.facebook.com/mousehunt/)
to retrieve information from my account.
So far, i've managed to make the application to login to my facebook account but i cannot make it navigate to mousehunt but even if i do so, my account will not be logged in please help.
My code is the following,
vb.net Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.WebBrowser1.Document.GetElementById("email").SetAttribute("value", TextBox1.Text)
WebBrowser1.Document.GetElementById("pass").SetAttribute("value", TextBox2.Text)
WebBrowser1.Document.GetElementById("Login").InvokeMember("click")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
WebBrowser1.Visible = True
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
WebBrowser1.ScriptErrorsSuppressed = True
End Sub
End Class
Re: Help on Facebook Login in VB2008
Parts of the code seem to be missing. Where is the WebBrowser1.Navigate? You're going to need to call WebBrowser1.Navigate("http%3A%2F%2Fapps.facebook.com%2Fmousehunt%2F") after your login logic.
Hope This Helps.
Re: Help on Facebook Login in VB2008
can you give me the code for it please ive tried just webbrowser1.navigate("www.apps.facebook/mousehunt")
but it does not log me in when it load pls help
Re: Help on Facebook Login in VB2008
Good Luck, it would appear you're just starting out here, and quite frankly web automation isnt the easiest thing to learn vb on..
Code:
Me.WebBrowser1.Document.GetElementById("email").SetAttribute("value", TextBox1.Text)
WebBrowser1.Document.GetElementById("pass").SetAttribute("value", TextBox2.Text)
WebBrowser1.Document.GetElementById("Login").InvokeMember("click")
WebBrowser1.Navigate("http://apps.facebook.com/mousehunt/")
Some things to remember... If the document isnt fully loaded in the webbrowser this code will fail, you might want to investigate the DocumentCompleted event
example:
Code:
Private Sub WebBrowser2_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser2.DocumentCompleted
'do work here
End Sub
Re: Help on Facebook Login in VB2008
how do you know if your logged into facebook already?
Re: Help on Facebook Login in VB2008
Well how does a user know if he/she is logged into facebook? You're probably going to need to "test" for it somehow, probably in the documentcompleted event. Take a look at this post, it might help you figure out how to do it. http://www.vbforums.com/showthread.p...ebbrowser+html
Re: Help on Facebook Login in VB2008
Sorry but i do not understand what the people are saying in the link ive tried to looping method but ive gotten an error when i run the application
Re: Help on Facebook Login in VB2008
HI,
while using the webbrowser the application will be slow why dont u try this code.
use the cookies and get response from website to login