Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom chrome binary options #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},

Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/jwebdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down