Skip to content

Commit

Permalink
fix: log browser version before remote
Browse files Browse the repository at this point in the history
because it might fail to connect with version mismatch error (chrome)
  • Loading branch information
Kelly Selden committed Jan 9, 2020
1 parent 8c7dc9d commit 60b2dcf
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions packages/remote/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ function startWebDriver(options = {}) {

webDriver.once('exit', killOrphans);

// Do this here instead of `startBrowser` for optimisation.
// We end up running it less often.
await logBrowserVersion(_browser);

return webDriver;
});
}
Expand All @@ -220,6 +224,52 @@ function stopWebDriver(webDriver) {
});
}

async function logBrowserVersion(browser) {
let location;
let args = [];
let options = {
preferLocal: false,
};
switch (browser) {
case 'chrome':
switch (process.platform) {
case 'darwin':
location = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
break;
case 'linux':
location = 'google-chrome';
break;
case 'win32':
// location = 'start';
// args.push('chrome');
location = 'chrome.exe';
// options.shell = true;
break;
}
args.push('--version');
break;
case 'firefox':
switch (process.platform) {
case 'darwin':
location = '/Applications/Firefox.app/Contents/MacOS/firefox-bin';
break;
case 'linux':
location = 'firefox';
options.shell = true;
break;
case 'win32':
// location = 'start';
// args.push('firefox');
location = 'firefox';
options.shell = true;
break;
}
args.push('-v');
break;
}
await spawnAwait(location, args, options);
}

async function getCapabilities({
customizeCapabilities = (browserName, capabilities) => capabilities,
overrides: {
Expand Down

0 comments on commit 60b2dcf

Please sign in to comment.