问题描述
有是已使用ColdFusion创建了一个网站(不知道这是否事项或没有)。我需要与本网站互动。我需要做的主要事情是导航到不同的页面,然后点击按钮。
There is a website that was created using ColdFusion (not sure if this matters or not). I need to interact with this web site. The main things I need to do are navigate to different pages and click buttons.
我想出了如何做到这两个想法。第一种方法是使用WebBrowser控件。有了这个,我当然可以浏览网页,然后点击按钮(据这)。
I have come up with two ideas on how to do this. The first is to use the WebBrowser control. With this, I could certainly navigate pages, and click buttons (According to This).
的另一种方法是直接的HTML交互。不知道究竟是如何做到这一点,但我假设我可以点击按钮或使用HTML请求与页面交互。
The other way is to interact with the html directly. Not sure exactly how to do this, but I am assuming I could click buttons or use HTML requests to interact with the page.
有没有人有一个建议,对哪种方式更好?有没有更好的办法,我没有想到的?
Does anyone have a recommendation on which way is better? Is there a better way that I haven't thought of?
推荐答案
我会使用。
I'd use Html AgilityPack to parse the html and then do POSTs and GETs appropriately with HttpWebRequest.
虽然有可能使用WebBrowser控件来模拟点击和导航你会得到更多的控制与HTML AgilityPack和HttpWebRequest的关于什么被发送
While it may be possible to use the WebBrowser control to simulate clicks and navigation you get more control with Html AgilityPack and HttpWebRequest regarding what gets sent
这篇关于与网页在C#交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!