nightwatch.js - 使用 nightwatch 时如何设置 Firefox 首选项

标签 nightwatch.js

从这个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/

相关文章:

nightwatch.js - 一个测试用例中的多个页面对象

css - 在测试环境中将测试数据属性设置为 react 应用程序中的 anchor

selenium-chromedriver - Nightwatch - 使用 chromedriver

javascript - 如何在页面部分嵌套 nightwatch.js 命令?

javascript - Nightwatch.js 错误 : "Cannot read propery ' equal' of undefined

url - 使用 Nightwatch.js 对 100 个 URL 运行相同的测试

node.js - CircleCI + 守夜人 : Tests time out

node.js - 通过 headless 浏览器提交表单 - NodeJS

javascript - 如何在 nightwatch.js 中显示 console.log?

selenium - NightwatchJS和Docker