Skip to content

Commit

Permalink
chore(local): if no local drivers provided in config, use update-conf…
Browse files Browse the repository at this point in the history
…ig.json

closes angular#3782
  • Loading branch information
cnishina committed Jan 3, 2017
1 parent c194af8 commit b7bdf63
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions lib/driverProviders/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,16 @@ export class Local extends DriverProvider {
logger.debug(
'Attempting to find the SeleniumServerJar in the default ' +
'location used by webdriver-manager');
this.config_.seleniumServerJar = path.resolve(
SeleniumConfig.getSeleniumDir(), new SeleniumStandAlone().executableFilename());
let updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json');
try {
let updateConfig = JSON.parse(fs.readFileSync(updateJson).toString());
this.config_.seleniumServerJar = updateConfig.standalone.last;
} catch (err) {
throw new BrowserError(
logger,
'No update-config.json found at ' + updateJson +
'. Run \'webdriver-manager update\' to download binaries.');
}
}
if (!fs.existsSync(this.config_.seleniumServerJar)) {
throw new BrowserError(
Expand All @@ -53,8 +61,16 @@ export class Local extends DriverProvider {
logger.debug(
'Attempting to find the chromedriver binary in the default ' +
'location used by webdriver-manager');
this.config_.chromeDriver = path.resolve(
SeleniumConfig.getSeleniumDir(), new SeleniumChrome().executableFilename());
let updateJson = path.resolve(SeleniumConfig.getSeleniumDir(), 'update-config.json');
try {
let updateConfig = JSON.parse(fs.readFileSync(updateJson).toString());
this.config_.chromeDriver = updateConfig.chrome.last;
} catch (err) {
throw new BrowserError(
logger,
'No update-config.json found at ' + updateJson +
'. Run \'webdriver-manager update\' to download binaries.');
}
}

// Check if file exists, if not try .exe or fail accordingly
Expand Down

0 comments on commit b7bdf63

Please sign in to comment.