C#WinForm应用程序实现自动填充网页上的用户名和密码并点击登录按钮【转载】

使用WebBrowser控件,在documentComplete事件处理器里写

 HtmlElement name = webBrowser1.Document.GetElementById("ctl00$content$loginname");
if (name != null)
name.SetAttribute("value", User);
HtmlElement pass = webBrowser1.Document.GetElementById("ctl00$content$pwd");
if (pass != null)
pass.SetAttribute("value", Password);
HtmlElement login = webBrowser1.Document.GetElementById("ctl00_content_summit");
if (login != null)
login.InvokeMember("click");
上一篇:HTML5基础 input file multiple 上传多个文件


下一篇:jQuery+Superfish制作下拉菜单