如何在CF3.5中使用HtmlDocument

时间:2014-01-02 17:06:18

标签: c# .net windows-ce

我正在使用在Windows CE上运行的设备,我需要自动执行登录过程。我能够使用下面的代码在Forms Application中实现这一点,但似乎我不能在智能设备上使用相同的过程。在CE工作时有没有办法做同样的事情?

        string butts = webBrowser1.Url.AbsoluteUri;
        HtmlDocument doc = webBrowser1.Document;
        HtmlElement userValue = doc.GetElementById("username");
        userValue.SetAttribute("value", "user");
        HtmlElement passValue = doc.GetElementById("password");
        passValue.SetAttribute("value", "pass");
        HtmlElement subButton = doc.GetElementById("submit");
        subButton.InvokeMember("click");

1 个答案:

答案 0 :(得分:2)

Compact Framework中不存在HtmlDocument类,实际上所有System.Windows.Forms.HtmlXxx对象都存在。

如果您要访问的内容非常少,则可以使用自己的实现。您也许可以从Mono代码库中借用一些。否则,确实没有任何好的答案。