Skip to content

Commit 20b4e91

Browse files
authored
#421 adding singleDriverStart to be used to start a single driver instance (#568)
1 parent 62c2405 commit 20b4e91

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

docs/CLI.md

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ selenium-standalone start -- hub
3838
selenium-standalone start -- node --grid-url http://localhost:4444/grid/register
3939
selenium-standalone start -- node --grid-url http://localhost:4444/grid/register -port 5556
4040

41+
# start a single driver
42+
selenium-standalone start --singleDriverStart=chrome
43+
4144
# don't forget to specify downloaded version for v4 alpha
4245
./bin/selenium-standalone start --version=4.0.0-alpha-7
4346

lib/start.js

+8
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ async function start(_opts) {
5050
opts.drivers = defaultConfig.drivers;
5151
}
5252

53+
if (opts.singleDriverStart) {
54+
const singleDriver = opts.drivers[opts.singleDriverStart];
55+
if (singleDriver) {
56+
opts.drivers = {};
57+
opts.drivers[opts.singleDriverStart] = singleDriver;
58+
}
59+
}
60+
5361
const fsPaths = computeFsPaths({
5462
seleniumVersion: opts.version,
5563
drivers: opts.drivers,

test/programmatic.js

+9
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,13 @@ describe('programmatic use', function () {
8888
}
8989
});
9090
});
91+
92+
it('should start with singleDriverStart options', (done) => {
93+
testStart(done, { singleDriverStart: 'firefox', drivers: { chrome: {} , firefox: {} }, seleniumArgs: ['--port', '4446']}, (cp) => {
94+
if (cp.spawnargs && cp.spawnargs.some(containsChrome)) {
95+
done(new Error('Chrome driver should not be loaded'));
96+
return false;
97+
}
98+
});
99+
});
91100
});

0 commit comments

Comments
 (0)