I need to visit a URL, find a specific text box in said page - fill it with data and then submit a form.
How can I accomplish this in C#?
P.S. Innocent intentions.
You'd be best looking at the WebRequest class (System.Net).
You'll want to look at the POST Method to post a form (click the submit button with the required fields completed).
Example:
// Create a request using a URL that can receive a post.
WebRequest request = WebRequest.Create ("http://www.contoso.com/PostAccepter.aspx ");
// Set the Method property of the request to POST.
request.Method = "POST";
// Create POST data and convert it to a byte array.
string postData = "This is a test that posts this string to a Web server.";
byte[] byteArray = Encoding.UTF8.GetBytes (postData);
There is a nice tutorial and lots of information on MSDN here. (Continuation of above source code)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With