We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
您可以使用
WebBrowser
控件,该控件可以在一定程度上实现自动化。You can use the
WebBrowser
control, which can be automated to an extent.我一直在使用 WatiN 效果很好。这是一种简单的方法,可以 1) 使用 IE 自动执行用户输入和 2) 导航 DOM。
I've been using WatiN to great effect. It's an easy way to 1) automate user input w/ IE and 2) navigate the DOM.
您需要使用 HTML Agility Pack,它可以将真实网站的标签汤解析为 DOM 结构。
You need to use the HTML Agility Pack, which can parse tag soup from real websites into a DOM structure.
您还可以使用 Selenium。它用于单元测试网站。它有一个驱动浏览器的 java 应用程序和一个可以在其中编写代码的 C# 界面。它也有显示浏览器的缺点,但它在控制、等待响应和获取结果方面功能相当齐全。
You can also use Selenium. It's for unit testing web sites. It has a java application that drives the browser and a C# interface that you can write your code in. It also has the downside of showing the browser, but it's pretty full featured in terms of control, waiting on responses and getting the results.
Design Canvas 是处理此类事情的最佳工具。适用于 IE、Firefox、Safari 或内存浏览器。它允许您录制然后回放任何类型的网络交互。
Design Canvas is the best tool out there for this type of thing. Works with IE, Firefox, Safari, or an in-memory browser. It allows you to record and then playback any kind of web interaction.
您需要 HttpWebRequest 来自动执行 Web 请求,并且 HtmlAgilityPack 用于处理生成的 HTML。
You want HttpWebRequest for automating web requests and HtmlAgilityPack for processing the resulting HTML.
我对 Python-Mechanize 进行了逆向工程,并用 C# 重新创建了它,称为 Mechanize.NET。
https://github.com/WilliamABradley/Mechanize.NET
这应该涵盖所有用例机械化,如果没有,或者你发现一个错误,创建一个问题。
它使用 .NET 标准,因此它应该可以跨 .NET 使用,例如 F#、VB 等。
它在内部使用 HtmlAgilityPack,您甚至可以收集每个加载页面的 HtmlDocument。
I have reverse engineered Python-Mechanize, and recreated it in C#, called Mechanize.NET.
https://github.com/WilliamABradley/Mechanize.NET
This should hopefully cover all use cases of Mechanize, if not, or you discover a bug, create an issue.
It uses .NET Standard, so it should be usable across .NET, such as with F#, VB, etc.
It utilises HtmlAgilityPack internally, and you can even collect the HtmlDocument for each loaded page.