日期:2014-05-16 浏览次数:20908 次
private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.Navigate(new Uri("http://www...../Login.aspx"));
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlElement ClickBtn = null;
if (e.Url.ToString().ToLower().IndexOf("login.aspx") > 0) //登陆页面
{
HtmlDocument doc = webBrowser1.Document;
for (int i = 0; i < doc.All.Count; i++)
{
if (doc.All[i].TagName.ToUpper().Equals("INPUT"))
{
switch (doc.All[i].Name)
{
case "txtUserName":
doc.All[i].InnerText = "user";
break;
case "txtPassword":
doc.All[i].InnerText = "123456";
break;
case "btnSubmit":
&nbs