我有以下@BeforeClass:
@BeforeClass
public static void setUpClass() {
FirefoxOptions options = new FirefoxOptions();
options.setBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe");
System.setProperty("webdriver.gecko.driver", "C:\\Users\\pburgr\\Desktop\\geckodriver-v0.19.1-win64\\geckodriver.exe");
driver = new FirefoxDriver(options);
driver.manage().window().maximize();
FirefoxProfile FF_profile = new FirefoxProfile();
FF_profile.setPreference("browser.download.folderList",2);
FF_profile.setPreference("browser.download.manager.showWhenStarting",false);
FF_profile.setPreference("browser.download.dir","C:\\users\\pburgr\\downloads\\");
FF_profile.setPreference("browser.helperApps.alwaysAsk.force", false);
FF_profile.setPreference("browser.helperApps.neverAsk.saveToDisk","application/application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
FF_profile.setPreference("pdfjs.disabled", true);
}
但是在下载 xlsx 文件时,我卡在了下载对话框中。我错过了什么?谢谢