Click paid advertisements are currently a popular online marketing model. However, if you simply click them one by one, you always feel that it is not cost-effective. Can you click them automatically? The answer is yes.
The webbrowser in. Net can satisfy our requirements. If you use the ideas in this article to make money, you will be at your own risk (
However, at present, this kind of thing is not easy to do, and various paid websites have taken measures to cope with it. Haha, the magic is full of feet, and the implementation is still feasible. It depends on everyone to make full use of it.)
The following is a part of the core code.
Private void webbrowserappsdocumentcompleted (Object sender, webbrowserdocumentcompletedeventargs E)
{
// Call the automatic logon process if you need to log on
// This. autologon ("Account", "password ");
// Obtain all links on the target page, analyze these links, and find the link to be clicked.
Htmlelementcollection links = This. webbrowser1.document. links;
Foreach (htmlelement link in links)
{
// Here I use the Google link for Example
If (link. getattribute ("href"). Contains ("Google.com "))
{
Link. invokemember ("click"); // click an event that triggers a link.
}
}
}
/// <Summary>
/// Automatic login, applicable to the absence of Verification Code
/// </Summary>
/// <Param name = "userid"> Logon account </param>
/// <Param name = "password"> logon password </param>
Private void autologon (string userid, string password)
{
# Region obtain the logon form input box and submit button
Htmlelement textboxuserid = This. webbrowser1.document. getelementbyid ("ID of the login username text box ");
// If there is no ID, use name to get it
// Htmlelement textboxuserid = This. webbrowser1.document. All ["Name of the login username text box"];
Htmlelement textboxpassword = This. webbrowser1.document. getelementbyid ("ID of the logon Password box ");
// If there is no ID, use name to get it
// Htmlelement textboxpassword = This. webbrowser1.document. All ["name in the logon Password box"];
Htmlelement buttonsubmit = This. webbrowser1.document. getelementbyid ("Login button ID ");
// If there is no ID, use name to get it
// Htmlelement buttonsubmit = This. webbrowser1.document. All ["Name of the logon button"];
Textboxuserid. setattribute ("value", userid); // enter the account
Textboxpassword. setattribute ("value", password); // enter the password
Buttonsubmit. invokemember ("click"); // click the event that triggers the submit button
// Of course, you can log on or use
// This. webbrowser1.document. Forms [0]. invokemember ("Submit ");
//. However, the preceding statement skips the browser client verification function (if any)
# Endregion
// After logging on, you must determine whether the logon is successful. You can use the URL
// Or this. webbrowser1.document. Body. innerhtml content to determine
}