Skip to content

Commit 93a00d5

Browse files
committed
[javascript] Selenium Manager use binary from Browser Options
#11351
1 parent 2c1bd8e commit 93a00d5

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

javascript/node/selenium-webdriver/common/seleniumManager.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,20 +72,28 @@ function driverLocation(options) {
7272
let args = [getBinary(), '--browser', options.getBrowserName(), '--output', 'json']
7373

7474
if (options.getBrowserVersion() && options.getBrowserVersion() !== "") {
75-
console.log("Present browserVersion! " + options.getBrowserVersion())
7675
args.push("--browser-version", options.getBrowserVersion())
7776
}
7877

79-
let output
78+
const vendorOptions = options.get('goog:chromeOptions') || options.get('ms:edgeOptions')
79+
|| options.get('moz:firefoxOptions')
80+
if (vendorOptions && vendorOptions.binary && vendorOptions.binary !== "") {
81+
args.push("--browser-path", '"' + vendorOptions.binary + '"')
82+
}
8083

84+
let output
8185
try {
8286
output = JSON.parse(execSync(args.join(' ')).toString())
8387
} catch (e) {
8488
let error
8589
try {
8690
error = JSON.parse(e.stdout.toString()).result.message
8791
} catch (e) {
88-
error = e.toString()
92+
if (e instanceof SyntaxError) {
93+
error = e.stdout.toString()
94+
} else {
95+
error = e.toString()
96+
}
8997
}
9098
throw new Error(`Error executing command with ${args}: ${error}`)
9199
}

third_party/third_party.iml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<module type="JAVA_MODULE" version="4">
3+
<component name="ModuleRunConfigurationManager">
4+
<shared />
5+
</component>
36
<component name="NewModuleRootManager" inherit-compiler-output="true">
47
<exclude-output />
58
<content url="file://$MODULE_DIR$">

0 commit comments

Comments
 (0)