允许每个实例一个代理的最佳 Web 浏览器控件是什么?

发布于 2024-10-09 22:20:36 字数 650 浏览 0 评论 0原文

我正在制作一个多线程[workers]应用程序。每个线程都应该有自己的非 GUI Web 浏览器,用于导航到网页并将数据写入字段并单击按钮。我还需要每个网络浏览器都有自己的代理。我尝试了经典的 Windows.Forms.WebBrowser 但我陷入了代理部分,因为它取决于 IE 全局设置,而这在我的情况下不起作用。欢迎任何建议。

注意:我尝试通过 HttpWebRequest/Response 执行此操作,但它永远不会工作,因为要传递到页面的数据包含一个名为 [ab_test_data] 的字段,该字段从 javascript 代码获取其值,该代码根据我不这样做的 AB 测试计算值甚至没有完全理解。因此,WebBrowser 将是我最好的解决方案,除非有人可以告诉我如何将计算 ab_test_data 的 Javascript 代码转换为 C# 代码。我尝试访问的页面使用的算法非常复杂。

注意2:ab_test_data值取决于Window.Event和Timestamp,不能在httpWebRequest/Response上模拟。

注意3:我尝试过Gecko,但它不会让我对网页执行任何操作,除非在表单上绘制GeckoWebBrowser(我不想要)。 欢迎任何解决方案。

编辑:如果您知道任何可以像我想要的那样以任何不同语言(也许是Java)工作的Web浏览器,我想知道。

提前致谢。

I am making a multi-threaded [workers] application. Each thread should have it's own Non-GUI WebBrowser that Navigates to a web page and writes data to fields and click a button. I also need each WebBrowser to have it's own proxy. I tried the classic Windows.Forms.WebBrowser but I got stuck at the proxy part as it depends on IE global settings which won't work in my case. Any recommendations are welcome.

note: I tried doing it through HttpWebRequest/Response but it will never work as the data to be passed to the page contains a field called [ab_test_data] which gets its value from javascript code that calculate the value according to AB testing which I don't even fully understand. So a WebBrowser would be my best solution, unless someone can tell me how to convert that Javascript code that calculates ab_test_data to C# code. The algorithm used by the page I am trying to access is really sophisticated.

note2: ab_test_data value depends on Window.Event and Timestamp which can't be simulated on a httpWebRequest/Response.

note3: I tried Gecko, But it won't let me do anything to the webPage unless GeckoWebBrowser is drawn on the form (which I don't want).
Any solutions are welcome.

edit: If you know any WebBrowser that works like I want in any different language (Maybe Java) I would like to know.

Thanks in advance.

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

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

发布评论

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

评论(3

盗心人 2024-10-16 22:20:36

作为一个可能有帮助的问题,我想知道为什么浏览器不允许每个(例如)窗口/选项卡使用代理?我认为这很大程度上是因为开发时间方面缺乏实用性。

也可能是因为浏览器[大概]具有用于 Web 请求和缓存等的集中式引擎......也许,允许每个窗口和/或选项卡代理将从根本上改变现代浏览器的设计和/或产生负面性能影响。我真的不知道。为了进一步说明这一点,请考虑隐身模式和隐私浏览等内容。在这些情况下,浏览器至少在概念上为每个窗口创建了单独的缓存......但我仍然打赌隐身窗口和标准窗口(在 Chrome 中)使用相同的底层 Web 请求引擎。

现在有很多人想要 JavaScript 和 DOM 解析器和解释器。 HtmlAgility PackJint正在帮忙,但似乎没有一个统一标准的解决方案;至少不是一个像网络浏览器那样简单的浏览器。

[下面咆哮]...

不幸的是,像 Jint 和 HtmlAgility 这样的项目令人担忧。其一,它们不是 IE、Chrome、Safari 或 FireFox。你并不完全知道自己正在陷入什么境地。例如,您知道在 Chrome 页面 xyz.com 中可以完美加载和呈现。您可以启动 FireFox,然后发现可能有些内容与其他浏览器不太一样,依此类推。但是,使用这些库,如果不是一切正常,您真的不知道会发生什么(没有视觉显示来进行快速检查)。另外,谁知道它们的开发速度是多少。他们跟上 HTML5 了吗?它们落后于主流浏览器吗?性能怎么样?更重要的是,浏览器已经具有诸如缓存和性能增强之类的功能,我怀疑您能否通过单独的库获得这些功能。

最好的浏览器控件当然是这样的:

IWebBrowser browser = new IE();
IWebBrowser browser = new Chrome();
IWebBrowser browser = new Safari();
IWebBrowser browser = new FireFox();

不幸的是,我认为这是一个梦想。其一,如果您想用这些插件加载怎么办?用户配置文件、用户登录信息等又如何呢?我认为我们大多数人只想要浏览器的功能,而不需要这些额外的功能。

我真心希望您能找到一个好的 Chrome 解决方案。我不知道您在 FireFox 领域会遇到什么运气(如果有的话)——也许您可以向我们通报最新情况?这些解决方案发展得如此之快 - 今天之前我从未听说过 CefSharp 或 WebKit.NET,几个月前我也在寻找同样的东西(Chrome 和/或 FireFox .NET 浏览器)供自己使用。如果很多人聚集在一起,制定一个标准界面,然后每个公司都根据该规范构建自己的嵌入式浏览器,那就太好了。在此许愿。

As a question that may help, I wonder why browsers don't allow a proxy per (say) window/tab? I think a lot of it is because of lack of usefulness with respect to development time.

It may also be because the browsers [presumably] have centralized engines for things like web requests and caches, etc... Perhaps, allowing a proxy per window and/or tab would fundamentally alter the design of the modern browser and or have negative performance impacts. I don't really know. To illustrate the point further, consider things like Incognito mode and Private Browsing. In these cases, the browsers have, at least, conceptually made separate caches per windows...but I still bet an Incognito window and a standard window (in Chrome) use the same underlying web request engine.

Right now there are so many people who want a JavaScript and DOM parser and interpreter. Projects like the HtmlAgility Pack and Jint are helping, but there doesn't seem to be a unified and standard solution; at least not one with the simplicity of a web browser.

[rant below]...

Unfortunately, projects like Jint and HtmlAgility are worrisome. For one, they're not IE, Chrome, Safari or FireFox. You don't exactly know what you're getting yourself into. For instance, you know that in Chrome page xyz.com loads and renders perfectly. You can fire up FireFox and see that maybe something is not quite the same and so on with the other browsers. But, with these libraries you don't really know what if not everything is working right (there's no visual display to do a quick check). Plus, who knows what pace they're being developed at. Do they keep up with HTML5? Do they lag behind the major browsers? What about performance? Even more so, browsers already have things like caching and performance enhancements, which I doubt you'll get with individual libraries.

The best browser control would of course be something like:

IWebBrowser browser = new IE();
IWebBrowser browser = new Chrome();
IWebBrowser browser = new Safari();
IWebBrowser browser = new FireFox();

I think that is a dream, unfortunately. For one, what if you ever wanted to load plug-ins with these? What about user profiles, user logins, and so on? I think most of us just want the muscle of the browsers without these extras.

I really do hope that you find a good Chrome solution. I don't know what, if any, luck you'll have in the FireFox realm - maybe you can keep us updated? These solutions are evolving so quickly - I had never even heard of CefSharp or WebKit.NET before today and I looked for the same thing (Chrome and/or FireFox .NET browsers) several months ago for my own use. It would be great if a lot of people got together, made a standard interface and then each company built their embedded browser against the spec. Here's to wishing.

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