简体   繁体   English

如何将WebBrowser发布到我的Facebook墙上?

[英]How to WebBrowser post on my facebook wall?

How to WebBrowser post on my wall? 如何将WebBrowser张贴在我的墙上?

I am using this code, he gets to play text in the textarea but not post. 我正在使用此代码,他可以在textarea中播放文本,但不能发布。

            HtmlElement ele = webBrowser1.Document.GetElementById("xhpc_message");
        if (ele != null)
            ele.InnerText = "Hello Word";



        ele = webBrowser1.Document.GetElementById("Post");
        if (ele != null)
            ele.InvokeMember("click");

Do I need to spend some more parameter? 我是否需要花费更多参数?

Try this, assuming that the field, "xhpc_message" is where you want to post your message: 假设您要在其中发布消息的字段“ xhpc_message”,请尝试以下操作:

    Dim inp As HtmlElement
    For Each inp In WebBrowser1.Document.GetElementsByTagName("textarea")
    If inp.GetAttribute("name") = "xhpc_message" Then
    inp.SetAttribute("value", "your text")
    End If
    Next

You will then need to figure out what the name of the submit button is to post the form. 然后,您需要弄清楚提交按钮的名称是要发布表单。

HtmlElement timelineContainer = null;

... ...

timelineContainer = webBrowser1.Document.GetElementById("timeline_react_composer_container");  
HtmlElement div1 = timelineContainer.FirstChild;

foreach (HtmlElement txtArea in div1.GetElementsByTagName("textarea"))
{
    if(txtArea.GetAttribute("name") == "xhpc_message_text")
    {
        txtArea.SetAttribute("value", "Test V2 \r\n http .. ");
        txtArea.Focus();
    }
}

... ...

HtmlElement btn = timelineContainer.GetElementsByTagName("button")[0];
btn.InvokeMember("click");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM