This is a c # programming. You can check it at will.
Well, what I will show you next is to automatically fill in the data and log on to the 126 mailbox, which also captures data;
Although this is very simple, it can also be used as a reference for me. I am writing an example here. I will rely on myself to further understand it. Haha start:
Figure 1.0 jump to the 126 logon page
Code:
Code
// Go to the page
Private void button#click (object sender, EventArgs e)
{
If (comboBox1.SelectedIndex = 0)
MessageBox. Show ("Please select a URL! ");
Else
{
Timer1.Enabled = true;
This. webBrowser1.Navigate (comboBox1.Text); // jump to the corresponding page
This. webBrowser1.IsWebBrowserContextMenuEnabled = true;
}
}
Figure 1.1 capture data
When you do not enter the password or user name, it will give you a prompt. Here we will take the prompt information:
Code
// 126 log on
Private void button3_Click (object sender, EventArgs e)
{
// Fill in the account
WebBrowser1.Document. GetElementById ("iptUser"). InnerText = textBox2.Text. Trim ();
// Fill in the password
WebBrowser1.Document. GetElementById ("iptPwd"). InnerText = textBox3.Text. Trim ();
// Call the logon button click event
WebBrowser1.Document. GetElementById ("enter. x"). InvokeMember ("click ");
// Obtain the prompt information
String ts = webBrowser1.Document. GetElementById ("error_div"). InnerText;
If (ts! = "")
MessageBox. Show (ts );
}
Here, the "iptUser" in the Code GetElementById ("iptUser") is the user name text box on the webpage page. In this step, the textBox is used. the value in text is filled in the text box with the ID "iptUser" in the webpage;
// Call the logon button click event
WebBrowser1.Document. GetElementById ("enter. x"). InvokeMember ("click ");
This row calls the "click" event of the button with the ID "enter. x;
Figure 1.2 Web Page code in the browser
Figure 1.3 logon successful
Bytes ------------------------------------------------------------------------------------------------
End! In fact, there is basically no amount of code, and it is easy to understand.
Tip: After you watch the video, please leave your valuable comments and suggestions,
Reprint of friends please indicate the original from http://www.cnblogs.com/song_ thank you!
Finally, I hope this article will give you some insights!