Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
helpers.setupNewChromedriver = async function setupNewChromedriver (opts, curDeviceId, adb) {
if (opts.chromeDriverPort) {
log.warn(`The 'chromeDriverPort' capability is deprecated. Please use 'chromedriverPort' instead`);
opts.chromedriverPort = opts.chromeDriverPort;
}
if (opts.chromedriverPort) {
log.debug(`Using user-specified port ${opts.chromedriverPort} for chromedriver`);
} else {
// if a single port wasn't given, we'll look for a free one
opts.chromedriverPort = await getChromedriverPort(opts.chromedriverPorts);
}
const chromedriver = new Chromedriver({
port: opts.chromedriverPort,
executable: opts.chromedriverExecutable,
adb,
cmdArgs: opts.chromedriverArgs,
verbose: !!opts.showChromedriverLog,
executableDir: opts.chromedriverExecutableDir,
mappingPath: opts.chromedriverChromeMappingFile,
bundleId: opts.chromeBundleId,
useSystemExecutable: opts.chromedriverUseSystemExecutable,
disableBuildCheck: opts.chromedriverDisableBuildCheck,
isAutodownloadEnabled: (this || {}).isChromedriverAutodownloadEnabled
? this.isChromedriverAutodownloadEnabled() : undefined,
});
// make sure there are chromeOptions
opts.chromeOptions = opts.chromeOptions || {};