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

Commit

Permalink
fix(direct): Use config's geckoDriver when specified (#4554)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
shaungrady authored and qiyigg committed Dec 15, 2017
1 parent 9d87982 commit 7f968e0
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions lib/driverProviders/direct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,26 @@ export class Direct extends DriverProvider {
break;
case 'firefox':
let geckoDriverFile: string;
try {
let updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json');
let updateConfig = JSON.parse(fs.readFileSync(updateJson).toString());
geckoDriverFile = updateConfig.gecko.last;
} catch (e) {
if (this.config_.geckoDriver) {
geckoDriverFile = this.config_.geckoDriver;
} else {
try {
let updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json');
let updateConfig = JSON.parse(fs.readFileSync(updateJson).toString());
geckoDriverFile = updateConfig.gecko.last;
} catch (e) {
throw new BrowserError(
logger,
'Could not find update-config.json. ' +
'Run \'webdriver-manager update\' to download binaries.');
}
}

if (!fs.existsSync(geckoDriverFile)) {
throw new BrowserError(
logger,
'Could not find update-config.json. ' +
'Run \'webdriver-manager update\' to download binaries.');
'Could not find geckodriver at ' + geckoDriverFile +
'. Run \'webdriver-manager update\' to download binaries.');
}

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

0 comments on commit 7f968e0

Please sign in to comment.