Reputation: 77
I want to write a program in c# that is able to visit websites and input text and possibly submit said text! I'm having trouble getting started and would like if someone could point me in the right direction with any tutorials or advice!
Upvotes: 0
Views: 159
Reputation: 9795
Depending on the scale of your project, you could likely just use the HTTPWebRequest
class in the System.Net
namespace. Using this class you can use the HTTP POST and GET methods to upload and retrieve information from URLs.
Even easier to use is the WebClient
class. Does similar stuff but requires less effort, although you have less control over the requests that you send.
https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/system.net.webclient(v=vs.110).aspx
I have used both often in the past and they work well. The only hiccup I've noticed is that HTTPWebResponse
will sometimes return with a status code of 100 Continue
and not send any of the data. Also, ensure you set the CachePolicy
of WebClient
before use to your intended value.
Upvotes: 1
Reputation: 3313
You can use Coded UI or Selenium for implementation.
Selenium automates browsers. That's it! What you do with that power is entirely up to you. Primarily, it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) also be automated as well.
Selenium has the support of some of the largest browser vendors who have taken (or are taking) steps to make Selenium a native part of their browser. It is also the core technology in countless other browser automation tools, APIs and frameworks.
Reference - http://www.seleniumhq.org/
Coded UI is Microsoft based UI automation library - You can follow this tutorial for it - https://msdn.microsoft.com/en-us/library/dd286726.aspx?f=255&MSPPError=-2147217396
Upvotes: 1
Reputation: 14024
You can go for selenium C# webdriver and examples of Web Scraping Whereas these days almost most of the websites have captcha thing to prevent these kind of spam activities on the website.
Upvotes: 1