【问题标题】:how to pass selenium-standalone port configuration from the command line如何从命令行传递 selenium-standalone 端口配置
【发布时间】:2020-02-12 15:48:46
【问题描述】:

我创建了 3 个链接到同一个 github 项目的 jenkins 作业,我正在使用 wdio v5 和 cucumber,我想在不同的端口上运行每个作业,这就是为什么我试图从 jenkins 传递端口后-构建任务:执行shell 我试过这个-- --seleniumArgs.seleniumArgs= ['-port', '7777'] 那么这个 -- --seleniumArgs.seleniumArgs= ["-port", "7777"] 然后 -- --seleniumArgs.seleniumArgs= '-port: 7777' 但没有任何效果

【问题讨论】:

    标签: cucumberjs wdio-v5


    【解决方案1】:

    我找到了解决办法:

    这是 wdio.conf.js 文件:

    var myArgs = process.argv.slice(2);
    Port= myArgs[1]
    
        exports.config = {
    
        ////////////////////////
    
    services: ['selenium-standalone'],
    seleniumArgs: {
    seleniumArgs: ['-port', Port]
    },
    
    //////////////////////
    
    }
    

    myArg 将收到一个数组,其中包含在命令行中传递的参数

    这是命令

    npm test 7777 -- --port 7777
    

    7777 是参数号 2,因此数组中的索引 1, 索引 0 是:wdio.conf.js,它在 package.json 的“测试”脚本中 ===>“测试”:“wdio wdio.conf.js”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-15
      • 1970-01-01
      相关资源
      最近更新 更多