如何为 nightwatch-api 以前的 nightwatch-cucumber 传递浏览器环境参数?

How to pass an browser env parameter for nightwatch-api formerly nightwatch-cucumber?

Nightwatch-cucumber is deprecated and we should use Nightwatch-api 根据作者。

我有一个设置,我将 selenium 网格与 Firefox 和 Chrome 节点一起使用 运行ning 等待激活。我没有在我的项目中设置任何 webdriver 设置。我仍然可以 运行 测试,但它只采用默认测试设置。

如何能够 运行 测试指定浏览器而不是默认浏览器?

根据 repo 中的示例,您应该能够通过两个文件(下面的链接)传递它,这将使您能够在所需的浏览器中执行它们(前提是它在 nightwatch.conf.js 文件中配置) .

https://github.com/mucsi96/nightwatch-api/blob/master/packages/selenium-hub-example/test/server.js

https://github.com/mucsi96/nightwatch-api/blob/master/packages/selenium-hub-example/test/support/setup.js

回购示例:

硒网格:https://github.com/mucsi96/nightwatch-api/tree/master/packages/selenium-hub-example

网络驱动程序:https://github.com/mucsi96/nightwatch-api/tree/master/packages/cucumber-example

Selenium 独立版:https://github.com/mucsi96/nightwatch-api/tree/master/packages/cucumber-selenium-example

如果这有助于解决您的问题,请采纳为答案。