Facebook注销等 [英] Facebook Logout and Like

查看:163
本文介绍了Facebook注销等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚接触VB.net并制作了一个Facebook的Windows应用程序。我只是做一些简单的事情,如登录,注销和喜欢的页面。
我可以使用帮助从 http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/94a8ce89-2318-4b14-9915-58f95ce58485



但是现在我停止注销并喜欢一个页面。我正在使用m.facebook.com来保持我的编码容易理解和方便。



请告诉我如何注销并喜欢页面。



facebook使用我无法从页面中提取的注销密钥。还有就是因为没有ID造成一些问题,所以我不能使用getelementbyid



感谢您的帮助

解决方案

如果有人面临同样的问题,这里是解决方案:



Facebook退出:

 昏暗allelements作为HtmlElementCollection = WebBrowser1.Document.All 

。对于每一个webpageelement作为的HtmlElement在allelements

。如果webpageelement.GetAttribute( 数据印记)= 登出 然后

WebBrowser1.Navigate时(webpageelement.GetAttribute(的 href))

结束如果

下一张

Facebook页面喜欢:

 昏暗allelements作为HtmlElementCollection = WebBrowser1.Document.All 

。对于每一个webpageelement作为的HtmlElement在allelements

。如果webpageelement.GetAttribute( value)=LikeThen

homepageelement.InvokeMember(click)

结束如果
下一个


I am new to VB.net and making a facebook windows app. I am doing just few simple things like login, log out and like a page. I was able to login in FB by using help from http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/94a8ce89-2318-4b14-9915-58f95ce58485

But now am stuck at log out and liking a page. I am using m.facebook.com so to keep my coding easy understandable and convenient.

Please tell me how to log out and like a page.

facebook uses a logout key that i am unable to extract from the page. And like is also creating some problem as there is no ID, so i cant use getelementbyid

thanks for help

解决方案

If someone is facing the same problem, here is the solution:

Facebook Logout:

Dim allelements As HtmlElementCollection = WebBrowser1.Document.All

    For Each webpageelement As HtmlElement In allelements

        If webpageelement.GetAttribute("data-sigil") = "logout" Then

            WebBrowser1.Navigate(webpageelement.GetAttribute("href"))

        End If

    Next

Facebook Page Like:

 Dim allelements As HtmlElementCollection = WebBrowser1.Document.All

    For Each webpageelement As HtmlElement In allelements

        If webpageelement.GetAttribute("value") = "Like" Then

            webpageelement.InvokeMember("click")                

        End If
    Next

这篇关于Facebook注销等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆