|
-
Oct 19th, 2009, 08:39 PM
#1
Thread Starter
New Member
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
Last edited by Hack; Oct 21st, 2009 at 08:24 AM.
Reason: Added Highlight Tags
-
Oct 20th, 2009, 12:45 AM
#2
Addicted Member
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.
-
Oct 21st, 2009, 07:36 AM
#3
Thread Starter
New Member
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
-
Oct 21st, 2009, 04:12 PM
#4
Addicted Member
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
-
Oct 22nd, 2009, 01:43 AM
#5
Thread Starter
New Member
Re: Help on Facebook Login in VB2008
how do you know if your logged into facebook already?
-
Oct 22nd, 2009, 12:23 PM
#6
Addicted Member
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
-
Oct 23rd, 2009, 08:49 PM
#7
Thread Starter
New Member
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
-
May 1st, 2011, 01:23 PM
#8
New Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|