Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async openBrowser (browserId, pageUrl, browserName) {
const args = browserName.split(' ');
const alias = args.shift();
const browserInfo = await browserTools.getBrowserInfo(alias);
const openParameters = Object.assign({}, browserInfo);
if (args.length)
openParameters.cmd = args.join(' ') + (openParameters.cmd ? ' ' + openParameters.cmd : '');
await browserTools.open(openParameters, pageUrl);
},
export async function start (pageUrl, { browserName, config, cdpPort, tempProfileDir, inDocker }) {
const chromeInfo = await browserTools.getBrowserInfo(config.path || browserName);
const chromeOpenParameters = Object.assign({}, chromeInfo);
chromeOpenParameters.cmd = buildChromeArgs({ config, cdpPort, platformArgs: chromeOpenParameters.cmd, tempProfileDir, inDocker });
await browserStarter.startBrowser(chromeOpenParameters, pageUrl);
}
async _handleString (str) {
const args = splitQuotedText(str, ' ', '`"\'');
const path = args.shift();
const browserInfo = await browserTools.getBrowserInfo(path);
if (!browserInfo)
return null;
const params = Object.assign({}, browserInfo);
if (args.length)
params.cmd = args.join(' ') + (params.cmd ? ' ' + params.cmd : '');
return params;
},
export async function start (pageUrl, { browserName, config, cdpPort, tempProfileDir, inDocker }) {
const chromeInfo = await browserTools.getBrowserInfo(config.path || browserName);
const chromeOpenParameters = Object.assign({}, chromeInfo);
chromeOpenParameters.cmd = buildChromeArgs({ config, cdpPort, platformArgs: chromeOpenParameters.cmd, tempProfileDir, inDocker });
await browserStarter.startBrowser(chromeOpenParameters, pageUrl);
}
export async function start (pageUrl, runtimeInfo) {
const { browserName, config } = runtimeInfo;
const firefoxInfo = await browserTools.getBrowserInfo(config.path || browserName);
const firefoxOpenParameters = Object.assign({}, firefoxInfo);
if (OS.mac && !config.userProfile)
correctOpenParametersForMac(firefoxOpenParameters);
firefoxOpenParameters.cmd = buildFirefoxArgs(config, firefoxOpenParameters.cmd, runtimeInfo, runtimeInfo.newInstance);
await browserStarter.startBrowser(firefoxOpenParameters, pageUrl);
}
async isValidBrowserName (browserName) {
const config = await this._getConfig(browserName);
const browserInfo = await getBrowserInfo(config.path || this._getBrowserName());
return !!browserInfo;
},
async _handleJSON (str) {
let params = null;
try {
params = JSON.parse(str);
}
catch (e) {
return null;
}
if (!params.path)
return null;
const openParameters = await browserTools.getBrowserInfo(params.path);
if (!openParameters)
return null;
if (params.cmd)
openParameters.cmd = params.cmd;
return openParameters;
},