且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

点击下载文件的保存或另存为对话框

更新时间:2022-12-09 12:42:58

我使用IE 11,并能够下载和关闭对话框



使用IE浏览器中的11文件下载自动化C#


I have seen couple of question posted on this topic but none of the solution worked that's why I am posting it again.

I am using WatIn to automate the testing of my website. Using IE 11. I have to download and save the file, but I am not able to click the save or saveas button of the download window. I tried FileDownloadHandler of WatIn but it didn't worked. I am not limited to WatIn only solutions. It could be anything thing which I can use in my C# code will be acceptable

FileDownloadHandler fileDownloadHandler = new FileDownloadHandler();
browser.AddDialogHandler(fileDownloadHandler);
browser.Image(Find.ByAlt("Download.Csv")).Ancestor("a").ClickNoWait();
fileDownloadHandler.WaitUntilFileDownloadDialogIsHandled(40);
fileDownloadHandler.WaitUntilDownloadCompleted(200);

I am using IE 11 and was able to download and close the dialog box

Automate of file download in IE 11 using c#