如何测试与华廷/ IE9文件下载? [英] How to test file download with Watin / IE9?

查看:136
本文介绍了如何测试与华廷/ IE9文件下载?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图来测试2.1.0华廷对IE9文件下载。我曾经建议code从受理问题的答案下载文件与华廷在IE9 的,是这样的:

I'm trying to test file download with Watin 2.1.0 against IE9. I used the suggested code from the accepted answer to the question Downloading a file with Watin in IE9, like this:

var downloadHandler = new FileDownloadHandler(fname);
WebBrowser.Current.AddDialogHandler(downloadHandler);
link.ClickNoWait();
downloadHandler.WaitUntilFileDownloadDialogIsHandled(15);
downloadHandler.WaitUntilDownloadCompleted(200);

但是, downloadHandler.WaitUntilFileDownloadDialogIsHandled(15)调用超时。我应该怎么办?

However, the downloadHandler.WaitUntilFileDownloadDialogIsHandled(15) call times out. What should I do?

推荐答案

IE9不再使用的保存文件对话框窗口。相反,它使用从网站上被删除的通知栏prevent焦点。见<一href=\"http://msdn.microsoft.com/en-us/ie/ff959805.aspx\">http://msdn.microsoft.com/en-us/ie/ff959805.aspx在下载管理器,以供参考。

IE9 no longer uses a dialog window for saving files. Instead, it uses the notification bar to prevent focus from being removed from the web site. See http://msdn.microsoft.com/en-us/ie/ff959805.aspx under "Download Manager" for reference.

不幸的是,这意味着在华廷当前FileDownloadHandler将不起作用。它实例化每个浏览器实例DialogWatcher类为任何类型的子窗口的基本消息泵。当遇到子窗口,所述DialogWatcher检查是否该窗口是具体的对话(其通知栏不是)。如果它是一个对话框,它然后遍历已注册IDialogHandler实例调用CanHandleDialog。即使通知栏是一个对话框,这是一个不同的窗口样式(http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600(v=vs.85).aspx),其中是华廷如何检测对话框的类型。

Unfortunately, this means that the current FileDownloadHandler in WatiN will not work. It instantiates a "DialogWatcher" class per browser instance that is a basic message pump for any kind of child window. When child windows are encountered, the DialogWatcher checks to see if the window is specifically a dialog (which the notification bar is not). If it is a dialog, it then iterates over the registered IDialogHandler instances calling "CanHandleDialog." Even if the notification bar were a dialog, it is of a different Window Style (http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600(v=vs.85).aspx), which is how WatiN detects the type of dialog.

这是我所看到的,有用于检测IE 9的通知栏及其在华廷提示不支持呢。在此之前,支持添加,你将不能够自动在IE9下载文件。

From what I can see, there is no support yet for detecting the IE 9 notification bar and its prompts in WatiN. Until that support is added, you will not be able to automate downloading files in IE9.

这篇关于如何测试与华廷/ IE9文件下载?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆