diff --git a/lib/browser.js b/lib/browser.js index 17535d5..311aaae 100644 --- a/lib/browser.js +++ b/lib/browser.js @@ -141,11 +141,12 @@ const Browser = PromiseClass.create({ * @param {String} platform * @param {Function} done callback function */ - constructor(driver, browserName, version, platform){ + constructor(driver, browserName, version, binaryPath,platform){ let self = this; self._driver = driver; self.browserName = browserName; self.version = version; + self.binaryPath = binaryPath; self.platform = platform; }, @@ -219,6 +220,7 @@ const Browser = PromiseClass.create({ args: ['--enable-automation', '--incognito'], }, } + if(self.binaryPath) sessionInfo.chromeOptions['binary'] = self.binaryPath; } if (sessionInfo.browserName !== 'chrome' && sessionInfo.chromeOptions) { delete sessionInfo.chromeOptions; diff --git a/lib/jwebdriver.js b/lib/jwebdriver.js index 2276654..7ccead4 100644 --- a/lib/jwebdriver.js +++ b/lib/jwebdriver.js @@ -297,7 +297,7 @@ const JWebDriver = PromiseClass.create({ * @param {Function} done callback function * @return {Browser} Browser object */ - session(browserName, version, platform, done){ + session(browserName, version, platform, binaryPath = false,done){ var self = this; if(typeof version === 'function'){ version = undefined; @@ -307,7 +307,7 @@ const JWebDriver = PromiseClass.create({ platform = undefined; } done = getDone(arguments); - let browser = new Browser(self, browserName, version, platform); + let browser = new Browser(self, browserName, version, binaryPath,platform); browser.init(function(error){ self.lastBrowser = browser; done(error, browser);