显示IE“另存为"使用 Watin 的对话框 [英] Show IE "Save As" dialog using Watin

查看:31
本文介绍了显示IE“另存为"使用 Watin 的对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人做过吗?导航到网页并弹出另存为对话框?这样浏览器就可以处理文件类型,html,pdf等...

Has anybody has done this? Navigating to a web page and pop up the save as dialog? In this way, the browser can handle the file type, html, pdf, etc...

推荐答案

当 FileHandler 被调用或在静态网页上时,你需要这个吗?

Do you need to this to be when a FileHandler is called or on a static webpage?

如果是在返回内容类型的处理程序页面上,则根据最新的 WatiN 发布文档,您可以执行以下操作:

If it is on a Handler page where the content type is returned then according the latest WatiN release documentation then you can do as follows:

using(IE ie = new IE(someUrlToGoTo))
{
    FileDownloadHandler fileDownloadHandler = new FileDownloadHandler(fullFileName);
    ie.AddDialogHandler(fileDownloadHandler);

    ie.Link("startDownloadLinkId").Click();

    fileDownloadHandler.WaitUntilFileDownloadDialogIsHandled(15);
    fileDownloadHandler.WaitUntilDownloadCompleted(200);
}

保罗

这篇关于显示IE“另存为"使用 Watin 的对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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