Title: how to pass selenium-standalone port configuration from the command line
Tags: cucumberjs;wdio-v5
Question: I created 3 jenkins jobs linked to the same github project, i'm using wdio v5 and cucumber, i want to run each job on a different port this is why i'm trying to pass the port from the jenkins post-build task : execute shell
I tryed this -- --seleniumArgs.seleniumArgs= ['-port', '7777']
then this
-- --seleniumArgs.seleniumArgs= ["-port", "7777"]
-- --seleniumArgs.seleniumArgs= '-port: 7777'
but nothing works


Here is another answer: i found a solution :
so this is the wdio.conf.js file :
var myArgs = process.argv.slice(2);
Port= myArgs[1]
exports.config = {
////////////////////////
services: ['selenium-standalone'],
seleniumArgs: {
seleniumArgs: ['-port', Port]
//////////////////////
myArg will receive an array with the arguments passed in the command line
and this is the command
npm test 7777 -- --port 7777
the 7777 is the argument number 2, thus the index 1 in the array,
the index 0 is : wdio.conf.js, which is in the "test" script in package.json
===> "test": "wdio wdio.conf.js"

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:02/12/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<cucumberjs><wdio-v5>', 'Title': 'how to pass selenium-standalone port configuration from the command line', 'ViewCount': 99, 'id': 60192152, 'user_AboutMe': None, 'user_AccountId': 17096747.0, 'user_DisplayName': 'mehdi', 'user_Reputation': 47.0, 'user_Views': 19.0, 'user_id': 12371579.0}}