I need to change the port number of which selenium standalone server is using by default (4444). Port 4444 is currently in use, is there a way to alter the port number via the wdio file?
JavaScript
x
6
1
// Test runner services
2
// Services take over a specific job you don't want to take care of. They enhance
3
// your test setup with almost no effort. Unlike plugins, they don't add new
4
// commands. Instead, they hook themselves up into the test process.
5
services: ['selenium-standalone'],
6
Currently I’m starting selenium server via the following command:
JavaScript
1
2
1
./node_modules/.bin/selenium-standalone start
2
I have also attempting to use the following with no luck:
JavaScript
1
2
1
./node_modules/.bin/selenium-standalone start -port 7777
2
Running the above command still attempt to run selenium sever on port 4444.
Advertisement
Answer
To run the selenium-standalone
on the specific port you should use the following syntax:
JavaScript
1
2
1
./node_modules/.bin/selenium-standalone start -- -port 7777
2
Change the port in the wdi.conf.js
:
JavaScript
1
4
1
seleniumArgs: {
2
seleniumArgs: ["-port", "7777"],
3
},
4
Also, read more about the wdio configuration file here and about wdio-cli here
So, your final wdio.conf.js
should look like:
JavaScript
1
11
11
1
exports.config = {
2
/**
3
* server configurations
4
*/
5
services: ['selenium-standalone'],
6
port: 7777,
7
seleniumArgs: {
8
seleniumArgs: ["-port", "7777"],
9
},
10
}
11