110,538
社区成员
发帖
与我相关
我的任务
分享
private void Form1_Load(object sender, EventArgs e)
{
wb1.Navigate("http://www.dzsyxx.com/");
try
{
HtmlElement txbUser = wb1.Document.All["TxtUserName"];
HtmlElement txbPass = wb1.Document.All["TxtPassword"];
if (txbUser == null || txbPass == null)
{
return;
}
txbUser.SetAttribute("value", "自动填写");
txbPass.SetAttribute("value", "自动填写");
}
catch (Exception ex)
{
txbJD.Text = ex.ToString();
}
this.webBrowser1.DocumentCompleted += new System.Windows.Forms.WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
try
{
HtmlElement txbUser = wb1.Document.All["TxtUserName"];
HtmlElement txbPass = wb1.Document.All["TxtPassword"];
if (txbUser == null || txbPass == null)
{
return;
}
txbUser.SetAttribute("value", "自动填写");
txbPass.SetAttribute("value", "自动填写");
}
catch (Exception ex)
{
txbJD.Text = ex.ToString();
}
}