Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 7f968e0

Browse files
shaungradyqiyigg
authored andcommitted
fix(direct): Use config's geckoDriver when specified (#4554)
* fix(direct): Use config's geckoDriver when specified This change makes the `firefox` capability more closely match `chrome`'s. The `firefox` capability was not looking for `config_.geckoDriver` like `chrome` was.
1 parent 9d87982 commit 7f968e0

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

lib/driverProviders/direct.ts

+18-7
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,26 @@ export class Direct extends DriverProvider {
9191
break;
9292
case 'firefox':
9393
let geckoDriverFile: string;
94-
try {
95-
let updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json');
96-
let updateConfig = JSON.parse(fs.readFileSync(updateJson).toString());
97-
geckoDriverFile = updateConfig.gecko.last;
98-
} catch (e) {
94+
if (this.config_.geckoDriver) {
95+
geckoDriverFile = this.config_.geckoDriver;
96+
} else {
97+
try {
98+
let updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json');
99+
let updateConfig = JSON.parse(fs.readFileSync(updateJson).toString());
100+
geckoDriverFile = updateConfig.gecko.last;
101+
} catch (e) {
102+
throw new BrowserError(
103+
logger,
104+
'Could not find update-config.json. ' +
105+
'Run \'webdriver-manager update\' to download binaries.');
106+
}
107+
}
108+
109+
if (!fs.existsSync(geckoDriverFile)) {
99110
throw new BrowserError(
100111
logger,
101-
'Could not find update-config.json. ' +
102-
'Run \'webdriver-manager update\' to download binaries.');
112+
'Could not find geckodriver at ' + geckoDriverFile +
113+
'. Run \'webdriver-manager update\' to download binaries.');
103114
}
104115

105116
// TODO (mgiambalvo): Turn this into an import when the selenium typings are updated.

0 commit comments

Comments
 (0)