是否有任何类型的 API 可以让我在 Firefox 中操作文件下载对话框?
(我想访问用户执行某些操作时出现的内容,而不是自己启动的内容)。
我想做的是从 Selenium 访问这个对话框(我也不确定 Selenium“特权模式”是否足以访问 chrome 界面)。
对于这个问题我有一个解决方案,查看代码:
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("browser.download.folderList",2);
firefoxProfile.setPreference("browser.download.manager.showWhenStarting",false);
firefoxProfile.setPreference("browser.download.dir","c:\\downloads");
firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk","text/csv");
WebDriver driver = new FirefoxDriver(firefoxProfile);//new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
driver.navigate().to("http://www.myfile.com/hey.csv");
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)