C# 中的 Web 浏览 - 库、工具等 - 有类似 Perl 中的 Mechanize 的东西吗?

发布于 2024-08-19 05:36:12 字数 1539 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

世俗缘 2024-08-26 05:36:12

您可以使用 WebBrowser 控件,该控件可以在一定程度上实现自动化。

You can use the WebBrowser control, which can be automated to an extent.

幻梦 2024-08-26 05:36:12

我一直在使用 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.

坚持沉默 2024-08-26 05:36:12

您需要使用 HTML Agility Pack,它可以将真实网站的标签汤解析为 DOM 结构。

You need to use the HTML Agility Pack, which can parse tag soup from real websites into a DOM structure.

番薯 2024-08-26 05:36:12

您还可以使用 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.

暮凉 2024-08-26 05:36:12

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.

可是我不能没有你 2024-08-26 05:36:12

您需要 HttpWebRequest 来自动执行 Web 请求,并且 HtmlAgilityPack 用于处理生成的 HTML。

You want HttpWebRequest for automating web requests and HtmlAgilityPack for processing the resulting HTML.

深巷少女 2024-08-26 05:36:12

我对 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文