填写VBulliten私人信息的文本

本文关键字:文本 信息 VBulliten 填写 | 更新日期: 2023-09-27 18:26:49

我正试图通过C#在网络论坛中提交一条私人消息。除了消息框本身,我可以填写每个组件:

nk

设置文本区域的innertext元素的常用方法根本没有任何作用,它适用于页面的其余部分,但不适用于此??我不知道为什么,我可以确认代码正确识别这个区域。我只能想象其他东西真正控制了显示和提交值。我发现:

当我将值设置为0以外的任何值时,消息将发布,但每次都缺少文本。

有什么想法吗?

填写VBulliten私人信息的文本

我不知道你最喜欢的访问网页的方法是什么,但你可以创建一个虚拟的WebBrowser表单,然后使用类似的函数:

    void SetText(string attribute, string attName, string value)
    {
        HtmlElementCollection tagsCollection = webBrowser1.Document.GetElementsByTagName("input");
        foreach (HtmlElement currentTag in tagsCollection)
        {
            if (currentTag.GetAttribute(attribute).Equals(attName))
                currentTag.SetAttribute("value", value);
        }
    }
    void CheckBox(string attribute, string attName, string value)
    {
        // Get a collection of all the tags with name "input";
        HtmlElementCollection tagsCollection = webBrowser1.Document.GetElementsByTagName("input");
        foreach (HtmlElement currentTag in tagsCollection)
        {
            if (currentTag.GetAttribute(attribute).Equals(attName))
                currentTag.SetAttribute("checked", value);
        }
    }

    void ClickButton(string attribute, string attName)
    {
        webBrowser1.Document.GetElementsByTagName("input");
        HtmlElementCollection col = webBrowser1.Document.GetElementsByTagName("button");
        foreach (HtmlElement element in col)
        {
            if (element.GetAttribute(attribute).Equals(attName))
            {
                element.InvokeMember("click");
            }
        }
    }