从这个answer
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);
使用 nightwatch 时如何设置 browser.download.manager.showWhenStarting
等属性?
最佳答案
根据我的理解,实现此目的的唯一方法是事先创建一个配置文件并在守夜人配置中使用该配置文件,类似于此处的说明:https://github.com/nightwatchjs/nightwatch/wiki/Enable-Firebug-in-Firefox-for-Nightwatch-tests
我希望有一种方法可以设置 firefox 首选项,因为使用我提供的解决方案,您的测试取决于在具有配置文件的机器上运行。
关于nightwatch.js - 使用 nightwatch 时如何设置 Firefox 首选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32371444/