本文介绍了C# (.NET) 的无头浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我(曾经)是一名 Python 开发人员,正在构建一个 GUI 网络抓取应用程序.最近我决定迁移到 .NET 框架并用 C# 编写相同的应用程序(这个决定不是我的决定).

I am (was) a Python developer who is building a GUI web scraping application. Recently I've decided to migrate to .NET framework and write the same application in C# (this decision wasn't mine).

在 Python 中,我使用了 Mechanize 库.但是,我似乎在 .NET 中找不到任何类似的东西.我需要的是一个以无头模式运行的浏览器,它能够填写表单、提交表单等.JavaScript 解析器不是必须的,但它会非常有用.

In Python, I've used the Mechanize library. However, I can't seem to find anything similar in .NET. What I need is a browser that will run in a headless mode, which has the ability to fill out forms, submit them, etc. JavaScript parser is not a must, but it would be quite useful.

推荐答案

有一些选择:

Awesomium
它基于 Chrome/WebKit 并且工作起来非常有魅力.有可用的免费许可证,但也有商业许可证,如果需要,您可以购买源代码 :-)

Awesomium
It is based on Chrome/WebKit and works like a charm.There is a free license available but also a commercial one and if need be you can buy the source code :-)

HTML Agility Pack(免费)(一个 HTML 解析器库, 不是无头浏览器)
这有助于从 HTML 等中提取信息,并且可能对您的情况有用(可能与 HttpWebRequest)

HTML Agility Pack (free) (An HTML Parser library, NOT a headless browser)
This helps with extracting information from HTML etc. and might be useful in your case (possibly in combination with HttpWebRequest)

这篇关于C# (.NET) 的无头浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 20:54