Interaction with web pages in C #

There is a website created using ColdFusion (not sure if it matters or not). I need to interact with this website. The main thing I need to do is go to different pages and click buttons.

I came up with two ideas on how to do this. The first is to use the WebBrowser control. With this, I could, of course, navigate the pages and click buttons (according to This ).

Another way is to interact directly with html. Not sure exactly how to do this, but I guess I can click buttons or use HTML requests to interact with the page.

Does anyone have any recommendations on which way is better? Is there a better way that I haven't thought about?

+7
source share
4 answers

I would use the Html AgilityPack to parse the html and then do the POST and GET accordingly with the HttpWebRequest .

Although you can use the WebBrowser control to simulate clicks and navigation, you get more control with the Html AgilityPack and HttpWebRequest regarding what is being sent

+7
source

Did you consider Selenium ? WebDriver API is not bad and allows a lot in terms of site automation.

+3
source

HtmlAguilityPack is useful for easily moving web elements and finding tags. If you need to remotely β€œmanage” a web session, I prefer to use WatiN . It is a web unit testing platform, but very useful anytime you need to fake a browser section. In addition, it can remotely control various browsers enough for most tasks that you need (for example, finding a button and pressing it or a text field and filling in the text if you need a login).

+2
source

why not send the URL directly? something that pressing the button will do. using WebRequest.Create , you can send the URL directly. No need to download, analyze and "click" button.

+1
source

All Articles