From 29168a4d0e9bd6c059e6ada03120832fc671a249 Mon Sep 17 00:00:00 2001 From: filipzamorsky Date: Wed, 29 May 2019 13:53:44 +0200 Subject: [PATCH 01/11] feat(selenium-grid): Add Selenium grid node support --- lib/cli/index.ts | 6 ++++++ lib/cmds/options.ts | 2 ++ lib/cmds/utils.ts | 1 + lib/provider/selenium_server.ts | 15 ++++++++++++++- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/cli/index.ts b/lib/cli/index.ts index a813596f..4d0c91ca 100644 --- a/lib/cli/index.ts +++ b/lib/cli/index.ts @@ -85,6 +85,11 @@ const standaloneNodeOption: yargs.Options = { describe: 'Start the selenium server standalone with role set to "node".', type: 'boolean' }; +const GRID_NODE = 'grid_node'; +const gridNodeOption: yargs.Options = { + describe: 'Start the selenium grid with role set to "node".', + type: 'string' +}; const VERSIONS_CHROME = 'versions.chrome'; const versionsChromeOption: yargs.Options = { describe: 'The chromedriver version.', @@ -139,6 +144,7 @@ yargs .option(SELENIUM_PORT, seleniumPort) .option(STANDALONE, standaloneOption) .option(STANDALONE_NODE, standaloneNodeOption) + .option(GRID_NODE, gridNodeOption) .option(VERSIONS_CHROME, versionsChromeOption) .option(VERSIONS_GECKO, versionsGeckoOption) .option(VERSIONS_IE, versionsIeOption) diff --git a/lib/cmds/options.ts b/lib/cmds/options.ts index 0b8848ee..73919fe0 100644 --- a/lib/cmds/options.ts +++ b/lib/cmds/options.ts @@ -37,6 +37,8 @@ export interface Server { version?: string; // Run as role = node option. runAsNode?: boolean; + // Run as grid node role = hub registration URI option. + runAsGrid?: string; // The relative or full path to the chrome logs file. chromeLogs?: string; // The full path to the edge driver server. diff --git a/lib/cmds/utils.ts b/lib/cmds/utils.ts index 714735fd..1b32552b 100644 --- a/lib/cmds/utils.ts +++ b/lib/cmds/utils.ts @@ -116,6 +116,7 @@ export function convertArgs2Options(argv: yargs.Arguments): Options { options.server = {}; options.server.name = 'selenium'; options.server.runAsNode = argv.standalone_node as boolean; + options.server.runAsGrid = argv.grid_node as string; options.server.runAsDetach = argv.detach as boolean; options.server.version = versionsStandalone; options.server.chromeLogs = argv.chrome_logs as string; diff --git a/lib/provider/selenium_server.ts b/lib/provider/selenium_server.ts index 0fa2f783..06060c2a 100644 --- a/lib/provider/selenium_server.ts +++ b/lib/provider/selenium_server.ts @@ -16,6 +16,7 @@ const log = loglevel.getLogger('webdriver-manager'); export interface SeleniumServerProviderConfig extends ProviderConfig { port?: number; runAsNode?: boolean; + runAsGrid?: boolean; runAsDetach?: boolean; } @@ -27,10 +28,12 @@ export class SeleniumServer implements ProviderInterface { osArch = os.arch(); outDir = OUT_DIR; port = 4444; + grid_node = 'http://localhost:4444/grid/register' proxy: string = null; requestUrl = 'https://selenium-release.storage.googleapis.com/'; seleniumProcess: childProcess.ChildProcess; runAsNode = false; + runAsGrid = false; runAsDetach = false; constructor(providerConfig?: SeleniumServerProviderConfig) { @@ -63,6 +66,9 @@ export class SeleniumServer implements ProviderInterface { if (providerConfig.runAsNode) { this.runAsNode = providerConfig.runAsNode; } + if (providerConfig.runAsGrid) { + this.runAsGrid = providerConfig.runAsGrid; + } if (providerConfig.runAsDetach) { this.runAsDetach = providerConfig.runAsDetach; this.runAsNode = true; @@ -182,7 +188,7 @@ export class SeleniumServer implements ProviderInterface { options.push('-jar'); options.push(jarFile); - if (this.runAsNode) { + if (this.runAsNode && !this.runAsGrid) { options.push('-role'); options.push('node'); @@ -192,6 +198,13 @@ export class SeleniumServer implements ProviderInterface { options.push('-registerCycle'); options.push('0'); } + if (this.runAsGrid) { + options.push('-role'); + options.push('node'); + + options.push('-hub'); + options.push(this.grid_node); + } options.push('-port'); options.push(this.port.toString()); From 1dbbcc186d19c62415421209fee910e80bb8edd4 Mon Sep 17 00:00:00 2001 From: filipzamorsky Date: Wed, 29 May 2019 14:32:11 +0200 Subject: [PATCH 02/11] Update git e-mail --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0058d669..717026a4 100644 --- a/README.md +++ b/README.md @@ -129,4 +129,4 @@ Options: --versions.gecko The geckodriver version. [string] --versions.ie The ie driver version. [string] --versions.standalone The selenium server standalone version. [string] -``` +``` \ No newline at end of file From 500bd1e27f89fc7b29ba3cf7c56295036a1f630b Mon Sep 17 00:00:00 2001 From: Filip Zamorsky Date: Wed, 29 May 2019 16:44:27 +0200 Subject: [PATCH 03/11] feat(selenium-grid): Change variable in selenium-server.ts --- lib/provider/selenium_server.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/provider/selenium_server.ts b/lib/provider/selenium_server.ts index 06060c2a..8e364c66 100644 --- a/lib/provider/selenium_server.ts +++ b/lib/provider/selenium_server.ts @@ -68,7 +68,7 @@ export class SeleniumServer implements ProviderInterface { } if (providerConfig.runAsGrid) { this.runAsGrid = providerConfig.runAsGrid; - } + } if (providerConfig.runAsDetach) { this.runAsDetach = providerConfig.runAsDetach; this.runAsNode = true; @@ -203,8 +203,8 @@ export class SeleniumServer implements ProviderInterface { options.push('node'); options.push('-hub'); - options.push(this.grid_node); - } + options.push(this.runAsNode); + } options.push('-port'); options.push(this.port.toString()); @@ -345,4 +345,4 @@ export function semanticVersionParser(xmlKey: string) { */ export function matchBinaries(): RegExp|null { return /selenium-server-standalone-\d+.\d+.\d+.*.jar/g; -} \ No newline at end of file +} From 9811807babb7c83604998ba08a20b9cd48a5793d Mon Sep 17 00:00:00 2001 From: Filip Zamorsky Date: Wed, 29 May 2019 16:56:12 +0200 Subject: [PATCH 04/11] feat(selenium-grid): Change variable and code formatting in selenium_server.ts --- lib/provider/selenium_server.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/provider/selenium_server.ts b/lib/provider/selenium_server.ts index 8e364c66..83e2454c 100644 --- a/lib/provider/selenium_server.ts +++ b/lib/provider/selenium_server.ts @@ -67,7 +67,7 @@ export class SeleniumServer implements ProviderInterface { this.runAsNode = providerConfig.runAsNode; } if (providerConfig.runAsGrid) { - this.runAsGrid = providerConfig.runAsGrid; + this.grid_node = providerConfig.runAsGrid; } if (providerConfig.runAsDetach) { this.runAsDetach = providerConfig.runAsDetach; @@ -199,11 +199,11 @@ export class SeleniumServer implements ProviderInterface { options.push('0'); } if (this.runAsGrid) { - options.push('-role'); - options.push('node'); + options.push('-role'); + options.push('node'); - options.push('-hub'); - options.push(this.runAsNode); + options.push('-hub'); + options.push(this.grid_node); } options.push('-port'); options.push(this.port.toString()); From 253f809eab2b7cb02b1c4062edb37711d0b96500 Mon Sep 17 00:00:00 2001 From: Filip Zamorsky Date: Wed, 29 May 2019 17:18:47 +0200 Subject: [PATCH 05/11] feat(selenium-grid): Update variables --- lib/cli/index.ts | 2 +- lib/cmds/options.ts | 2 +- lib/cmds/utils.ts | 2 +- lib/provider/selenium_server.ts | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/cli/index.ts b/lib/cli/index.ts index 4d0c91ca..33567076 100644 --- a/lib/cli/index.ts +++ b/lib/cli/index.ts @@ -88,7 +88,7 @@ const standaloneNodeOption: yargs.Options = { const GRID_NODE = 'grid_node'; const gridNodeOption: yargs.Options = { describe: 'Start the selenium grid with role set to "node".', - type: 'string' + type: 'boolean' }; const VERSIONS_CHROME = 'versions.chrome'; const versionsChromeOption: yargs.Options = { diff --git a/lib/cmds/options.ts b/lib/cmds/options.ts index 73919fe0..b6bd6aed 100644 --- a/lib/cmds/options.ts +++ b/lib/cmds/options.ts @@ -38,7 +38,7 @@ export interface Server { // Run as role = node option. runAsNode?: boolean; // Run as grid node role = hub registration URI option. - runAsGrid?: string; + runAsGrid?: boolean; // The relative or full path to the chrome logs file. chromeLogs?: string; // The full path to the edge driver server. diff --git a/lib/cmds/utils.ts b/lib/cmds/utils.ts index 1b32552b..189cf9e3 100644 --- a/lib/cmds/utils.ts +++ b/lib/cmds/utils.ts @@ -116,7 +116,7 @@ export function convertArgs2Options(argv: yargs.Arguments): Options { options.server = {}; options.server.name = 'selenium'; options.server.runAsNode = argv.standalone_node as boolean; - options.server.runAsGrid = argv.grid_node as string; + options.server.runAsGrid = argv.grid_node as boolean; options.server.runAsDetach = argv.detach as boolean; options.server.version = versionsStandalone; options.server.chromeLogs = argv.chrome_logs as string; diff --git a/lib/provider/selenium_server.ts b/lib/provider/selenium_server.ts index 83e2454c..88332fea 100644 --- a/lib/provider/selenium_server.ts +++ b/lib/provider/selenium_server.ts @@ -15,6 +15,7 @@ const log = loglevel.getLogger('webdriver-manager'); export interface SeleniumServerProviderConfig extends ProviderConfig { port?: number; + grid_node?: string; runAsNode?: boolean; runAsGrid?: boolean; runAsDetach?: boolean; @@ -67,7 +68,7 @@ export class SeleniumServer implements ProviderInterface { this.runAsNode = providerConfig.runAsNode; } if (providerConfig.runAsGrid) { - this.grid_node = providerConfig.runAsGrid; + this.runAsGrid = providerConfig.runAsGrid; } if (providerConfig.runAsDetach) { this.runAsDetach = providerConfig.runAsDetach; From a9193a079ef8a1335bc463db716d752af01928ce Mon Sep 17 00:00:00 2001 From: Filip Zamorsky Date: Thu, 30 May 2019 11:06:18 +0200 Subject: [PATCH 06/11] Fix issues after running tests --- lib/cli/index.ts | 4 ++-- lib/provider/selenium_server.ts | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/cli/index.ts b/lib/cli/index.ts index 33567076..1d9aeb4a 100644 --- a/lib/cli/index.ts +++ b/lib/cli/index.ts @@ -87,8 +87,8 @@ const standaloneNodeOption: yargs.Options = { }; const GRID_NODE = 'grid_node'; const gridNodeOption: yargs.Options = { - describe: 'Start the selenium grid with role set to "node".', - type: 'boolean' + describe: 'Start the selenium grid with role set to "node".', + type: 'boolean' }; const VERSIONS_CHROME = 'versions.chrome'; const versionsChromeOption: yargs.Options = { diff --git a/lib/provider/selenium_server.ts b/lib/provider/selenium_server.ts index 88332fea..678970f3 100644 --- a/lib/provider/selenium_server.ts +++ b/lib/provider/selenium_server.ts @@ -15,7 +15,7 @@ const log = loglevel.getLogger('webdriver-manager'); export interface SeleniumServerProviderConfig extends ProviderConfig { port?: number; - grid_node?: string; + gridNode?: string; runAsNode?: boolean; runAsGrid?: boolean; runAsDetach?: boolean; @@ -29,7 +29,7 @@ export class SeleniumServer implements ProviderInterface { osArch = os.arch(); outDir = OUT_DIR; port = 4444; - grid_node = 'http://localhost:4444/grid/register' + gridNode = 'http://localhost:4444/grid/register'; proxy: string = null; requestUrl = 'https://selenium-release.storage.googleapis.com/'; seleniumProcess: childProcess.ChildProcess; @@ -68,7 +68,7 @@ export class SeleniumServer implements ProviderInterface { this.runAsNode = providerConfig.runAsNode; } if (providerConfig.runAsGrid) { - this.runAsGrid = providerConfig.runAsGrid; + this.runAsGrid = providerConfig.runAsGrid; } if (providerConfig.runAsDetach) { this.runAsDetach = providerConfig.runAsDetach; @@ -202,9 +202,9 @@ export class SeleniumServer implements ProviderInterface { if (this.runAsGrid) { options.push('-role'); options.push('node'); - + options.push('-hub'); - options.push(this.grid_node); + options.push(this.gridNode); } options.push('-port'); options.push(this.port.toString()); From 8c334a79be5190a73b148b9d9de3ed6bd3192647 Mon Sep 17 00:00:00 2001 From: Filip Zamorsky Date: Fri, 31 May 2019 14:32:28 +0200 Subject: [PATCH 07/11] feat(selenium-grid) Add runAsGrid functionality and fix issues --- lib/cli/index.ts | 4 ++-- lib/cmds/options.ts | 4 ++-- lib/cmds/utils.ts | 7 ++++++- lib/provider/selenium_server.ts | 13 ++++++++----- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/cli/index.ts b/lib/cli/index.ts index 1d9aeb4a..ed21ffe7 100644 --- a/lib/cli/index.ts +++ b/lib/cli/index.ts @@ -85,10 +85,10 @@ const standaloneNodeOption: yargs.Options = { describe: 'Start the selenium server standalone with role set to "node".', type: 'boolean' }; -const GRID_NODE = 'grid_node'; +const GRID_NODE = 'gridNode'; const gridNodeOption: yargs.Options = { describe: 'Start the selenium grid with role set to "node".', - type: 'boolean' + type: 'string' }; const VERSIONS_CHROME = 'versions.chrome'; const versionsChromeOption: yargs.Options = { diff --git a/lib/cmds/options.ts b/lib/cmds/options.ts index b6bd6aed..a48935ca 100644 --- a/lib/cmds/options.ts +++ b/lib/cmds/options.ts @@ -37,8 +37,8 @@ export interface Server { version?: string; // Run as role = node option. runAsNode?: boolean; - // Run as grid node role = hub registration URI option. - runAsGrid?: boolean; + // Run as grid node role = hub registration URL path. + gridNode?: string; // The relative or full path to the chrome logs file. chromeLogs?: string; // The full path to the edge driver server. diff --git a/lib/cmds/utils.ts b/lib/cmds/utils.ts index 189cf9e3..e51a2ce1 100644 --- a/lib/cmds/utils.ts +++ b/lib/cmds/utils.ts @@ -42,6 +42,7 @@ export function addOptionsBinary(options: Options): OptionsBinary { seleniumProviderConfig.port = optionsBinary.server.port; seleniumProviderConfig.runAsDetach = optionsBinary.server.runAsDetach; seleniumProviderConfig.runAsNode = optionsBinary.server.runAsNode; + seleniumProviderConfig.gridNode = optionsBinary.server.gridNode; optionsBinary.server.binary = new SeleniumServer(seleniumProviderConfig); } return optionsBinary; @@ -112,11 +113,15 @@ export function convertArgs2Options(argv: yargs.Arguments): Options { if (argv.iedriver as boolean) { options.browserDrivers.push({name: 'iedriver', version: versionsIe}); } + if (argv.gridNode as string === '') { + console.log('Please specify a grid hub URL...'); + process.exit(); + } if (argv.standalone as boolean) { options.server = {}; options.server.name = 'selenium'; options.server.runAsNode = argv.standalone_node as boolean; - options.server.runAsGrid = argv.grid_node as boolean; + options.server.gridNode = argv.gridNode as string; options.server.runAsDetach = argv.detach as boolean; options.server.version = versionsStandalone; options.server.chromeLogs = argv.chrome_logs as string; diff --git a/lib/provider/selenium_server.ts b/lib/provider/selenium_server.ts index 678970f3..981e9619 100644 --- a/lib/provider/selenium_server.ts +++ b/lib/provider/selenium_server.ts @@ -29,7 +29,7 @@ export class SeleniumServer implements ProviderInterface { osArch = os.arch(); outDir = OUT_DIR; port = 4444; - gridNode = 'http://localhost:4444/grid/register'; + gridNode = ''; proxy: string = null; requestUrl = 'https://selenium-release.storage.googleapis.com/'; seleniumProcess: childProcess.ChildProcess; @@ -67,8 +67,9 @@ export class SeleniumServer implements ProviderInterface { if (providerConfig.runAsNode) { this.runAsNode = providerConfig.runAsNode; } - if (providerConfig.runAsGrid) { - this.runAsGrid = providerConfig.runAsGrid; + if (providerConfig.gridNode) { + this.runAsGrid = true; + this.gridNode = providerConfig.gridNode; } if (providerConfig.runAsDetach) { this.runAsDetach = providerConfig.runAsDetach; @@ -206,8 +207,10 @@ export class SeleniumServer implements ProviderInterface { options.push('-hub'); options.push(this.gridNode); } - options.push('-port'); - options.push(this.port.toString()); + if (!this.runAsGrid) { + options.push('-port'); + options.push(this.port.toString()); + } return options; } From e2851da54abdae7f9412b412b322ae88de23c591 Mon Sep 17 00:00:00 2001 From: Filip Zamorsky Date: Fri, 31 May 2019 16:11:04 +0200 Subject: [PATCH 08/11] feat(selenium-grid): Write unit test for a selenium grid node option --- lib/provider/selenium_server.spec-unit.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/provider/selenium_server.spec-unit.ts b/lib/provider/selenium_server.spec-unit.ts index 0701216d..18d7edd8 100644 --- a/lib/provider/selenium_server.spec-unit.ts +++ b/lib/provider/selenium_server.spec-unit.ts @@ -38,6 +38,8 @@ describe('selenium_server', () => { const javaArgs = '-role node ' + '-servlet org.openqa.grid.web.servlet.LifecycleServlet ' + '-registerCycle 0 -port 4444'; + const javaGridArgs = '-role node ' + + '-hub '; const javaArgsPort = '-port 4444'; it('should use a selenium server with no options', () => { spyOn(fs, 'readFileSync').and.returnValue(configBinaries); @@ -71,6 +73,20 @@ describe('selenium_server', () => { '-Dwebdriver.chrome.driver=path/to/chromedriver ' + '-jar path/to/selenium-server-3.0.jar ' + javaArgs); }); + + it('should use a selenium server with a grid node option', () => { + spyOn(fs, 'readFileSync').and.returnValue(configBinaries); + const seleniumServer = new SeleniumServer(); + seleniumServer.runAsDetach = true; + seleniumServer.runAsNode = true; + seleniumServer.runAsGrid = true; + const cmd = seleniumServer.getCmdStartServer( + {'-Dwebdriver.chrome.driver': 'path/to/chromedriver'}); + expect(cmd.join(' ')) + .toContain( + '-Dwebdriver.chrome.driver=path/to/chromedriver ' + + '-jar path/to/selenium-server-3.0.jar ' + javaGridArgs); + }); }); describe('getStatus', () => { From 690e5c4ce4246d837e3d82fe7a39f5b46e7f7f5d Mon Sep 17 00:00:00 2001 From: Filip Zamorsky Date: Thu, 13 Jun 2019 14:26:06 +0200 Subject: [PATCH 09/11] Reset README.md file --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 717026a4..0058d669 100644 --- a/README.md +++ b/README.md @@ -129,4 +129,4 @@ Options: --versions.gecko The geckodriver version. [string] --versions.ie The ie driver version. [string] --versions.standalone The selenium server standalone version. [string] -``` \ No newline at end of file +``` From db8c83718d3e3087aa38af24137ace6c6397ae56 Mon Sep 17 00:00:00 2001 From: Filip Zamorsky Date: Thu, 13 Jun 2019 17:14:31 +0200 Subject: [PATCH 10/11] Resolve suggestions --- lib/cli/index.ts | 8 ++++++++ lib/cmds/options.ts | 2 +- lib/cmds/utils.ts | 7 ++++++- lib/provider/selenium_server.ts | 10 +++++++--- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/lib/cli/index.ts b/lib/cli/index.ts index 0968116d..700ba9ad 100644 --- a/lib/cli/index.ts +++ b/lib/cli/index.ts @@ -121,6 +121,12 @@ const seleniumNodeOption: yargs.Options = { describe: 'Start the selenium server standalone with role set to "node".', type: 'boolean' }; +const SELENIUM_GRID_URL_ALIAS = 'standalone_grid_url'; +const SELENIUM_GRID_URL = 'selenium_grid_url'; +const seleniumGridNodeOption: yargs.Options = { + describe: 'Start the selenium grid with role set to "node".', + type: 'string' +}; const VERSIONS_CHROMEDRIVER_ALIAS = 'versions.chrome'; const VERSIONS_CHROMEDRIVER = 'versions.chromedriver'; const versionsChromedriverOption: yargs.Options = { @@ -186,6 +192,8 @@ yargs .option(SELENIUM_LOG_LEVEL, seleniumLogLevelOption) .option(SELENIUM_NODE, seleniumNodeOption) .alias(SELENIUM_NODE_ALIAS, SELENIUM_NODE) + .option(SELENIUM_GRID_URL, seleniumGridNodeOption) + .alias(SELENIUM_GRID_URL_ALIAS, SELENIUM_GRID_URL) .option(SELENIUM_PORT, seleniumPort) .option(VERSIONS_CHROMEDRIVER, versionsChromedriverOption) .alias(VERSIONS_CHROMEDRIVER_ALIAS, VERSIONS_CHROMEDRIVER) diff --git a/lib/cmds/options.ts b/lib/cmds/options.ts index 41e4d406..f7fe4ca2 100644 --- a/lib/cmds/options.ts +++ b/lib/cmds/options.ts @@ -44,7 +44,7 @@ export interface Server { // Run as role = node option. runAsNode?: boolean; // Run as grid node role = hub registration URL path. - gridNode?: string; + gridUrl?: string; // The relative or full path to the chrome logs file. chromeLogs?: string; // The full path to the edge driver server. diff --git a/lib/cmds/utils.ts b/lib/cmds/utils.ts index a3c8a345..f917b1ef 100644 --- a/lib/cmds/utils.ts +++ b/lib/cmds/utils.ts @@ -42,7 +42,7 @@ export function addOptionsBinary(options: Options): OptionsBinary { seleniumProviderConfig.port = optionsBinary.server.port; seleniumProviderConfig.runAsDetach = optionsBinary.server.runAsDetach; seleniumProviderConfig.runAsNode = optionsBinary.server.runAsNode; - seleniumProviderConfig.gridNode = optionsBinary.server.gridNode; + seleniumProviderConfig.gridUrl = optionsBinary.server.gridUrl; seleniumProviderConfig.logLevel = optionsBinary.server.logLevel; optionsBinary.server.binary = new SeleniumServer(seleniumProviderConfig); } @@ -90,10 +90,15 @@ export function convertArgs2Options(argv: yargs.Arguments): Options { if (argv['iedriver'] as boolean) { setVersions('iedriver', argv, options.browserDrivers); } + if (argv['gridUrl'] === true) { + console.log('Please specify a grid hub URL...'); + process.exit(); + } if (argv['selenium']) { options.server = {}; options.server.name = 'selenium'; options.server.runAsNode = argv['selenium_node'] as boolean; + options.server.gridUrl = argv['gridUrl'] as string; options.server.runAsDetach = argv.detach as boolean; options.server.version = argv['versions'] && argv['versions']['selenium'] ? argv['versions']['selenium'] as string : undefined; diff --git a/lib/provider/selenium_server.ts b/lib/provider/selenium_server.ts index 76a87347..6a0662b3 100644 --- a/lib/provider/selenium_server.ts +++ b/lib/provider/selenium_server.ts @@ -15,7 +15,7 @@ const log = loglevel.getLogger('webdriver-manager'); export interface SeleniumServerProviderConfig extends ProviderConfig { port?: number; - gridNode?: string; + gridUrl?: string; runAsNode?: boolean; runAsGrid?: boolean; runAsDetach?: boolean; @@ -30,7 +30,7 @@ export class SeleniumServer extends ProviderClass implements ProviderInterface { osArch = os.arch(); outDir = OUT_DIR; port = 4444; - gridNode = ''; + gridUrl = ''; proxy: string = null; requestUrl = 'https://selenium-release.storage.googleapis.com/'; seleniumProcess: childProcess.ChildProcess; @@ -54,10 +54,14 @@ export class SeleniumServer extends ProviderClass implements ProviderInterface { this.proxy = this.setVar('proxy', this.proxy, config); this.requestUrl = this.setVar('requestUrl', this.requestUrl, config); this.runAsNode = this.setVar('runAsNode', this.runAsNode, config); + this.gridUrl = this.setVar('gridUrl', this.gridUrl, config); this.runAsDetach = this.setVar('runAsDetach', this.runAsDetach, config); if (this.runAsDetach) { this.runAsNode = true; } + if (this.gridUrl !== '') { + this.runAsGrid = true; + } this.version = this.setVar('version', this.version, config); this.maxVersion = this.setVar('maxVersion', this.maxVersion, config); this.logLevel = this.setVar('logLevel', this.logLevel, config); @@ -211,7 +215,7 @@ export class SeleniumServer extends ProviderClass implements ProviderInterface { options.push('node'); options.push('-hub'); - options.push(this.gridNode); + options.push(this.gridUrl); } if (!this.runAsGrid) { options.push('-port'); From 063bd56e7adccc17aecba358f7a87fa67576bd07 Mon Sep 17 00:00:00 2001 From: Filip Zamorsky Date: Thu, 13 Jun 2019 17:22:42 +0200 Subject: [PATCH 11/11] Delete empty row at the end of the selenium_server.ts file --- lib/provider/selenium_server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/provider/selenium_server.ts b/lib/provider/selenium_server.ts index 6a0662b3..85db2595 100644 --- a/lib/provider/selenium_server.ts +++ b/lib/provider/selenium_server.ts @@ -359,4 +359,4 @@ export function semanticVersionParser(xmlKey: string) { */ export function matchBinaries(): RegExp|null { return /selenium-server-standalone-\d+.\d+.\d+.*.jar/g; -} +} \ No newline at end of file