问题
I'm working on a Device that runs on windows CE and i need to automate a login process. I was able to achieve this in a Forms Application using the code below but it doesn't seem like I can use the same process on the smart device. Is there a way to do the same thing while working in 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:
The HtmlDocument
class, and really all of the System.Windows.Forms.HtmlXxx
objects do not exist in the Compact Framework.
If you have a very small set of things you want to access, you might be able to roll your own implementation. You might be able to borrow some from the Mono code base as well. Otherwise, there really aren't any good answers.
来源:https://stackoverflow.com/questions/20887889/how-do-i-use-htmldocument-in-cf3-5