简体   繁体   English

WebBrowser控件不下载图像

[英]WebBrowser control do not download images

I am automating the process of downloading my bank statement. 我正在自动下载银行对帐单。 The way I do this is by using a win forms WebBrowser control. 我这样做的方法是使用Win Forms WebBrowser控件。 I navigate to https://www.bankofamerica.com/ then I find the username and password textboxes in the dom fill them in with c# send click event to the submit button etc etc. Eventually I get to the statement I want to download when ready I just parse the page source. 我导航到https://www.bankofamerica.com/,然后在dom中找到用户名和密码文本框,并使用c#将click事件发送到Submit按钮等。最终,我得到了要下载的语句准备好我只是解析页面源代码。

The process works but it is very slow. 该过程有效,但是非常慢。 In summary I will like to improve the performance of this process These are the things I am considering: 总而言之,我想改善此过程的性能,这些是我正在考虑的事情:

  1. Use fiddler to see the requests and responses hoping I could automate the same process. 使用提琴手查看请求和响应,希望我可以自动执行相同的过程。 (The problem with this approach is that the connection is encrypted also I have to set cookies and I belive it will be to complicated to do it this way). (这种方法的问题是,连接也已加密,因此我必须设置cookie,我相信这样做会很复杂)。

  2. Prevent WebBrowser Control from downloading images and css. 阻止WebBrowser控件下载图像和CSS。 That way the page.Ready event will fire earlier and the process could be faster. 这样,page.Ready事件将更早触发,并且过程可能更快。

I will rader go with option number 2 because I know very little about fiddler and just know the basics of http. 我会选择第2个选项,因为我对Fiddler的了解很少,只了解http的基础知识。 How can I speed up this process? 我如何加快这个过程?

It's trivial to capture encrypted traffic with Fiddler; 用Fiddler捕获加密的流量很简单。 simply enable the Decrypt HTTPS connections option. 只需启用“解密HTTPS连接”选项。

It's also easy to disable download of images from the Web Browser control using the "Ambient DLControl" flags. 使用“环境DLControl”标志来禁用从Web浏览器控件中下载图像也很容易。 See http://www.tech-archive.net/Archive/InetSDK/microsoft.public.inetsdk.programming.webbrowser_ctl/2009-01/msg00035.html for an example. 有关示例,请参见http://www.tech-archive.net/Archive/InetSDK/microsoft.public.inetsdk.programming.webbrowser_ctl/2009-01/msg00035.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM