【发布时间】:2015-10-07 17:12:11
【问题描述】:
我找到了静默下载文件的解决方案(没有打开/保存对话框),但找不到任何用于设置 WebDriver 配置文件自动打开文件而不保存的内容。
使用 Selenium 和 C#。该文件是 .csv,这是我的代码:
FirefoxProfile profile = new FirefoxProfile();
//set to automatically open file
profile.SetPreference("browser.helperApps.alwaysAsk.force", false);
profile.SetPreference("browser.helperApps.neverAsk.openFile","text/csv,application/vnd.ms-excel,application/excel");
profile.SetPreference("browser.download.manager.showWhenStarting", false);
Instance = new FirefoxDriver(profile);
我是否缺少插件的某些内容?
【问题讨论】:
标签: c# excel selenium selenium-firefoxdriver