为了账号安全,请及时绑定邮箱和手机立即绑定

如何通过 webdriverio wdio 文件更改 selenium-standalone

如何通过 webdriverio wdio 文件更改 selenium-standalone

吃鸡游戏 2021-08-20 14:35:31
我需要更改默认情况下使用的 selenium 独立服务器的端口号 (4444)。端口 4444 当前正在使用,有没有办法通过 wdio 文件更改端口号?// Test runner services// Services take over a specific job you don't want to take care of. They enhance// your test setup with almost no effort. Unlike plugins, they don't add new// commands. Instead, they hook themselves up into the test process.services: ['selenium-standalone'],目前我正在通过以下命令启动 selenium 服务器:./node_modules/.bin/selenium-standalone start我也尝试使用以下方法但没有运气:./node_modules/.bin/selenium-standalone start -port 7777运行上述命令仍然尝试在端口 4444 上运行 selenium 服务器。
查看完整描述

2 回答

?
狐的传说

TA贡献1804条经验 获得超3个赞

要selenium-standalone在特定端口上运行,您应该使用以下语法:


./node_modules/.bin/selenium-standalone start -- -port 7777

更改 中的端口wdi.conf.js:


seleniumArgs: {

  seleniumArgs: ["-port", "7777"],

},

另外,在这里阅读更多关于 wdio 配置文件和关于 wdio-cli 的信息


所以,你的最终结果wdio.conf.js应该是这样的:


exports.config = {

  /**

  * server configurations

  */

  services: ['selenium-standalone'],

  port: 7777,

  seleniumArgs: {

    seleniumArgs: ["-port", "7777"],

  },

}


查看完整回答
反对 回复 2021-08-20
?
catspeake

TA贡献1111条经验 获得超0个赞

nodejs webdriver-manager start --seleniumPort 5555


查看完整回答
反对 回复 2021-08-20
  • 2 回答
  • 0 关注
  • 175 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信