@@ -25,7 +25,6 @@ const { platform } = require('node:process')
25
25
const path = require ( 'node:path' )
26
26
const fs = require ( 'node:fs' )
27
27
const spawnSync = require ( 'node:child_process' ) . spawnSync
28
- const { Capability } = require ( '../lib/capabilities' )
29
28
const logging = require ( '../lib/logging' )
30
29
31
30
const log_ = logging . getLogger ( logging . Type . DRIVER )
@@ -63,38 +62,12 @@ function getBinary() {
63
62
64
63
/**
65
64
* Determines the path of the correct driver
66
- * @param {Capabilities } options browser options to fetch the driver
65
+ * @param {string[] } args arguments to invoke Selenium Manager
67
66
* @returns {{browserPath: string, driverPath: string} } path of the driver and
68
67
* browser location
69
68
*/
70
69
71
- function driverLocation ( options ) {
72
- let args = [ '--browser' , options . getBrowserName ( ) , '--language-binding' , 'javascript' , '--output' , 'json' ]
73
-
74
- if ( options . getBrowserVersion ( ) && options . getBrowserVersion ( ) !== '' ) {
75
- args . push ( '--browser-version' , options . getBrowserVersion ( ) )
76
- }
77
-
78
- const vendorOptions =
79
- options . get ( 'goog:chromeOptions' ) || options . get ( 'ms:edgeOptions' ) || options . get ( 'moz:firefoxOptions' )
80
- if ( vendorOptions && vendorOptions . binary && vendorOptions . binary !== '' ) {
81
- args . push ( '--browser-path' , path . resolve ( vendorOptions . binary ) )
82
- }
83
-
84
- const proxyOptions = options . getProxy ( )
85
-
86
- // Check if proxyOptions exists and has properties
87
- if ( proxyOptions && Object . keys ( proxyOptions ) . length > 0 ) {
88
- const httpProxy = proxyOptions [ 'httpProxy' ]
89
- const sslProxy = proxyOptions [ 'sslProxy' ]
90
-
91
- if ( httpProxy !== undefined ) {
92
- args . push ( '--proxy' , httpProxy )
93
- } else if ( sslProxy !== undefined ) {
94
- args . push ( '--proxy' , sslProxy )
95
- }
96
- }
97
-
70
+ function binaryPaths ( args ) {
98
71
const smBinary = getBinary ( )
99
72
const spawnResult = spawnSync ( smBinary , args )
100
73
let output
@@ -120,11 +93,6 @@ function driverLocation(options) {
120
93
throw new Error ( `Error executing command for ${ smBinary } with ${ args } : ${ e . toString ( ) } ` )
121
94
}
122
95
123
- // Once driverPath is available, delete browserVersion from payload
124
- if ( output . result . driver_path ) {
125
- options . delete ( Capability . BROWSER_VERSION )
126
- }
127
-
128
96
logOutput ( output )
129
97
return {
130
98
driverPath : output . result . driver_path ,
@@ -144,4 +112,4 @@ function logOutput(output) {
144
112
}
145
113
146
114
// PUBLIC API
147
- module . exports = { driverLocation }
115
+ module . exports = { binaryPaths }
0 commit comments