Skip to content

Commit ecd6d6b

Browse files
committed
[javascript] Removing logic to find drivers, delegating to SM
Completes #11356
1 parent 838a70f commit ecd6d6b

5 files changed

Lines changed: 6 additions & 112 deletions

File tree

javascript/node/selenium-webdriver/chrome.js

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,6 @@ const io = require('./io')
131131
const { Browser } = require('./lib/capabilities')
132132
const chromium = require('./chromium')
133133

134-
/**
135-
* Name of the ChromeDriver executable.
136-
* @type {string}
137-
* @const
138-
*/
139-
const CHROMEDRIVER_EXE =
140-
process.platform === 'win32' ? 'chromedriver.exe' : 'chromedriver'
141-
142134
/** @type {remote.DriverService} */
143135

144136
/**
@@ -156,8 +148,7 @@ class ServiceBuilder extends chromium.ServiceBuilder {
156148
* cannot be found on the PATH.
157149
*/
158150
constructor(opt_exe) {
159-
let exe = opt_exe || locateSynchronously()
160-
super(exe)
151+
super(opt_exe)
161152
}
162153
}
163154

@@ -242,16 +233,6 @@ class Driver extends chromium.Driver {
242233
}
243234
}
244235

245-
/**
246-
* _Synchronously_ attempts to locate the chromedriver executable on the current
247-
* system.
248-
*
249-
* @return {?string} the located executable, or `null`.
250-
*/
251-
function locateSynchronously() {
252-
return io.findInPath(CHROMEDRIVER_EXE, true)
253-
}
254-
255236
Options.prototype.CAPABILITY_KEY = 'goog:chromeOptions'
256237
Options.prototype.BROWSER_NAME_VALUE = Browser.CHROME
257238
Driver.prototype.VENDOR_COMMAND_PREFIX = 'goog'
@@ -261,5 +242,4 @@ module.exports = {
261242
Driver: Driver,
262243
Options,
263244
ServiceBuilder,
264-
locateSynchronously,
265245
}

javascript/node/selenium-webdriver/edge.js

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,8 @@
7878
'use strict'
7979

8080
const { Browser } = require('./lib/capabilities')
81-
const io = require('./io')
8281
const chromium = require('./chromium')
8382

84-
/**
85-
* Name of the EdgeDriver executable.
86-
* @type {string}
87-
* @const
88-
*/
89-
const EDGEDRIVER_CHROMIUM_EXE =
90-
process.platform === 'win32' ? 'msedgedriver.exe' : 'msedgedriver'
91-
9283
/** @type {remote.DriverService} */
9384

9485
/**
@@ -105,8 +96,7 @@ class ServiceBuilder extends chromium.ServiceBuilder {
10596
* cannot be found on the PATH.
10697
*/
10798
constructor(opt_exe) {
108-
let exe = opt_exe || locateSynchronously()
109-
super(exe)
99+
super(opt_exe)
110100
this.setLoopback(true)
111101
}
112102
}
@@ -177,16 +167,6 @@ class Driver extends chromium.Driver {
177167
setFileDetector() {}
178168
}
179169

180-
/**
181-
* _Synchronously_ attempts to locate the chromedriver executable on the current
182-
* system.
183-
*
184-
* @return {?string} the located executable, or `null`.
185-
*/
186-
function locateSynchronously() {
187-
return io.findInPath(EDGEDRIVER_CHROMIUM_EXE, true)
188-
}
189-
190170
Options.prototype.BROWSER_NAME_VALUE = Browser.EDGE
191171
Options.prototype.CAPABILITY_KEY = 'ms:edgeOptions'
192172
Driver.prototype.VENDOR_CAPABILITY_PREFIX = 'ms'
@@ -197,5 +177,4 @@ module.exports = {
197177
Driver,
198178
Options,
199179
ServiceBuilder,
200-
locateSynchronously,
201180
}

javascript/node/selenium-webdriver/firefox.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -453,27 +453,6 @@ const Context = {
453453
CHROME: 'chrome',
454454
}
455455

456-
const GECKO_DRIVER_EXE =
457-
process.platform === 'win32' ? 'geckodriver.exe' : 'geckodriver'
458-
459-
/**
460-
* _Synchronously_ attempts to locate the geckodriver executable on the current
461-
* system.
462-
*
463-
* @return {?string} the located executable, or `null`.
464-
*/
465-
function locateSynchronously() {
466-
return io.findInPath(GECKO_DRIVER_EXE, true)
467-
}
468-
469-
/**
470-
* @return {string} .
471-
* @throws {Error}
472-
*/
473-
function findGeckoDriver() {
474-
return locateSynchronously()
475-
}
476-
477456
/**
478457
* @param {string} file Path to the file to find, relative to the program files
479458
* root.
@@ -555,7 +534,7 @@ class ServiceBuilder extends remote.DriverService.Builder {
555534
* the builder will attempt to locate the geckodriver on the system PATH.
556535
*/
557536
constructor(opt_exe) {
558-
super(opt_exe || findGeckoDriver())
537+
super(opt_exe)
559538
this.setLoopback(true) // Required.
560539
}
561540

@@ -832,5 +811,4 @@ module.exports = {
832811
Driver,
833812
Options,
834813
ServiceBuilder,
835-
locateSynchronously,
836814
}

javascript/node/selenium-webdriver/ie.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,14 @@
2727

2828
'use strict'
2929

30-
const fs = require('fs')
3130
const http = require('./http')
32-
const io = require('./io')
3331
const portprober = require('./net/portprober')
3432
const remote = require('./remote')
3533
const webdriver = require('./lib/webdriver')
3634
const { Browser, Capabilities } = require('./lib/capabilities')
3735
const error = require('./lib/error')
3836
const { getPath } = require('./common/driverFinder')
3937

40-
const IEDRIVER_EXE = 'IEDriverServer.exe'
4138
const OPTIONS_CAPABILITY_KEY = 'se:ieOptions'
4239
const SCROLL_BEHAVIOUR = {
4340
BOTTOM: 1,
@@ -380,16 +377,6 @@ class Options extends Capabilities {
380377
}
381378
}
382379

383-
/**
384-
* _Synchronously_ attempts to locate the IE driver executable on the current
385-
* system.
386-
*
387-
* @return {?string} the located executable, or `null`.
388-
*/
389-
function locateSynchronously() {
390-
return process.platform === 'win32' ? io.findInPath(IEDRIVER_EXE, true) : null
391-
}
392-
393380
function createServiceFromCapabilities(capabilities) {
394381
if (process.platform !== 'win32') {
395382
throw Error(
@@ -400,7 +387,7 @@ function createServiceFromCapabilities(capabilities) {
400387
)
401388
}
402389

403-
let exe = locateSynchronously()
390+
let exe = null // Let Selenium Manager find it
404391
var args = []
405392
if (capabilities.has(Key.HOST)) {
406393
args.push('--host=' + capabilities.get(Key.HOST))
@@ -440,7 +427,7 @@ class ServiceBuilder extends remote.DriverService.Builder {
440427
* the builder will attempt to locate the IEDriverServer on the system PATH.
441428
*/
442429
constructor(opt_exe) {
443-
super(opt_exe || IEDRIVER_EXE)
430+
super(opt_exe)
444431
this.setLoopback(true) // Required.
445432
}
446433
}
@@ -496,4 +483,3 @@ exports.ServiceBuilder = ServiceBuilder
496483
exports.Key = Key
497484
exports.VENDOR_COMMAND_PREFIX = OPTIONS_CAPABILITY_KEY
498485
exports.Behavior = SCROLL_BEHAVIOUR
499-
exports.locateSynchronously = locateSynchronously

javascript/node/selenium-webdriver/safari.js

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,10 @@
2222
'use strict'
2323

2424
const http = require('./http')
25-
const io = require('./io')
2625
const remote = require('./remote')
2726
const webdriver = require('./lib/webdriver')
2827
const { Browser, Capabilities } = require('./lib/capabilities')
2928

30-
/**
31-
* _Synchronously_ attempts to locate the IE driver executable on the current
32-
* system.
33-
*
34-
* @return {?string} the located executable, or `null`.
35-
*/
36-
function locateSynchronously() {
37-
return process.platform === 'darwin'
38-
? io.findInPath('safaridriver', true)
39-
: null
40-
}
41-
42-
/**
43-
* @return {string} .
44-
* @throws {Error}
45-
*/
46-
function findSafariDriver() {
47-
let exe = locateSynchronously()
48-
if (!exe) {
49-
throw Error(
50-
`The safaridriver executable could not be found on the current PATH.
51-
Please ensure you are using Safari 10.0 or above.`
52-
)
53-
}
54-
return exe
55-
}
56-
5729
/**
5830
* Creates {@link selenium-webdriver/remote.DriverService} instances that manage
5931
* a [safaridriver] server in a child process.
@@ -66,7 +38,7 @@ class ServiceBuilder extends remote.DriverService.Builder {
6638
* the builder will attempt to locate the safaridriver on the system PATH.
6739
*/
6840
constructor(opt_exe) {
69-
super(opt_exe || findSafariDriver())
41+
super(opt_exe)
7042
this.setLoopback(true) // Required.
7143
}
7244
}
@@ -165,4 +137,3 @@ class Driver extends webdriver.WebDriver {
165137
exports.Driver = Driver
166138
exports.Options = Options
167139
exports.ServiceBuilder = ServiceBuilder
168-
exports.locateSynchronously = locateSynchronously

0 commit comments

Comments
 (0)