Member Avatar for The Road To Voi

So basically I want to login to FaceBook and check if I have any notifications.

I haven't a clue how to check if I have notifications and I'm not very good at all with HTML so I'm not sure what I'm looking for in the page source to grab the notification info. So if anyone is able to show me how I'll be very happy.

Any help with this issue is appreciated :)

P.S. The reason I'm doing this is because I have a Velleman circuit (similar to Arduino) that connects to the computer via USB and I can control it with programs I've made in C#. I'm going to make it light up certain LED's depending on notifications I have on my profile, I just have to work out how to get that information first then I'm away :)

This is how I'm logging in, and it works completely fine.

bool loggedOn = false;

        private void frm_Main_Load(object sender, EventArgs e)
        {
            web_FBCheck.Navigate("https://login.facebook.com/login.php?login_attempt=1");
        }

        private void web_FBCheck_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (!loggedOn)
            {
                HtmlElement emailElement = web_FBCheck.Document.GetElementById("email");
                HtmlElement passwordElement = web_FBCheck.Document.GetElementById("pass");
                HtmlElement loginButtonElement = web_FBCheck.Document.GetElementById("Login");

                if (emailElement != null)
                {
                    emailElement.InnerText = "username@hotmail.com";
                }

                if (passwordElement != null)
                {
                    passwordElement.InnerText = "password";
                }

                if (loginButtonElement != null)
                {
                    loginButtonElement.InvokeMember("click");
                }
            }
        }
Member Avatar for The Road To Voi

I worked it out, marking as solved.

How'd you fix it, just for posterity?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.