using
System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load( object sender, EventArgs e)
{
webBrowser1.Url = new Uri( " http://www.gmail.com " );
}
private void webBrowser1_DocumentCompleted( object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlElement txtUserHtml = webBrowser1.Document.All[ " Email " ];
HtmlElement txtPasswordHtml = webBrowser1.Document.All[ " Passwd " ];
HtmlElement btnClickHtml = webBrowser1.Document.All[ " signIn " ];
txtUserHtml.SetAttribute( " value " , " 这里填写用户名 " ); // 输入用户名
txtPasswordHtml.SetAttribute( " value " , " 这里填写密码 " ); // 输入密码
btnClickHtml.InvokeMember( " click " );
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load( object sender, EventArgs e)
{
webBrowser1.Url = new Uri( " http://www.gmail.com " );
}
private void webBrowser1_DocumentCompleted( object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlElement txtUserHtml = webBrowser1.Document.All[ " Email " ];
HtmlElement txtPasswordHtml = webBrowser1.Document.All[ " Passwd " ];
HtmlElement btnClickHtml = webBrowser1.Document.All[ " signIn " ];
txtUserHtml.SetAttribute( " value " , " 这里填写用户名 " ); // 输入用户名
txtPasswordHtml.SetAttribute( " value " , " 这里填写密码 " ); // 输入密码
btnClickHtml.InvokeMember( " click " );
}
}
}