playwright-fluent
Version:
Fluent API around playwright
43 lines (42 loc) • 1.73 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getChromeCanaryPath = exports.getChromePath = void 0;
const tslib_1 = require("tslib");
const which = (0, tslib_1.__importStar)(require("which"));
const os = (0, tslib_1.__importStar)(require("os"));
const fs_1 = require("fs");
const currentPlatformType = os.type();
const x86Path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe';
const x64Path = 'C:/Program Files/Google/Chrome/Application/chrome.exe';
function getChromePath() {
switch (currentPlatformType) {
case 'Darwin':
return '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
case 'Windows_NT':
if ((0, fs_1.existsSync)(x64Path)) {
return x64Path;
}
return x86Path;
case 'Linux':
if (which.sync('google-chrome-stable', { nothrow: true })) {
return 'google-chrome-stable';
}
return 'google-chrome';
default:
throw new Error('You should supply the path to the Chrome App in the launch options');
}
}
exports.getChromePath = getChromePath;
function getChromeCanaryPath() {
switch (currentPlatformType) {
case 'Darwin':
return '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary';
case 'Windows_NT':
return 'C:/Program Files (x86)/Google/Chrome SxS/Application/chrome.exe';
case 'Linux':
return 'google-chrome-unstable';
default:
throw new Error('You should supply the path to the Chrome Canary App in the launch options');
}
}
exports.getChromeCanaryPath = getChromeCanaryPath;
;