Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
selenium.install(opts, function(err) {
if (err) {
console.error('Failed to install selenium');
process.exit(1);
}
selenium.start(opts, function(err, server) {
sauceClient = wd.promiseChainRemote();
callback();
});
});
}
function onSeleniumInstalled(err) {
if (err) {
console.error(err);
return process.exit(1);
}
selenium.start({seleniumArgs: ['-debug']}, onSeleniumStarted);
}
selenium.install(opts, function (err) {
if (err) {
console.error('Failed to install selenium');
process.exit(1);
}
selenium.start(opts, function () {
sauceClient = wd.promiseChainRemote();
callback();
});
});
}
selenium.install(opts, function(err) {
if (err) {
console.error('Failed to install selenium');
process.exit(1);
}
selenium.start(opts, function(err, server) {
sauceClient = wd.promiseChainRemote();
callback();
});
});
}
function startSelenium(callback) {
selenium.start(function() {
var browser = wd.promiseChainRemote();
callback(browser);
});
}
selenium.install({ logger: console.log }, function (installError) {
if (installError) {
console.log('Error while installing selenium:', installError)
}
selenium.start(function (startError, child) {
if (startError) {
console.log('Error while starting selenium:', startError)
return process.exit(1)
} else {
console.log('Selenium started!')
function killSelenium () {
child.kill()
console.log('Just killed selenium!')
}
if (manualStop) {
callback(killSelenium)
}else {
onExit(killSelenium)
callback()
}
}
}, err => {
if (err) return done(err)
selenium.start({
spawnOptions: {
stdio: 'ignore'
}
}, (err, child) => {
selenium.child = child
console.log('Selenium error: ', err)
done()
})
})
})
function startSelenium(done) {
selenium.start((err, child) => {
seleniumServer = child;
done(err);
});
}
return;
}
self.seleniumStandaloneOptions.seleniumArgs = ['-port', port];
if (process.env['chimp.log'] === 'verbose' || process.env['chimp.log'] === 'debug') {
self.options.seleniumDebug = true;
}
if (self.options.seleniumDebug) {
self.seleniumStandaloneOptions.seleniumArgs.push('-debug');
}
log.debug('\n[chimp][selenium] hub can be seen at http://localhost:' + port + '/wd/hub');
selenium.start(self.seleniumStandaloneOptions, function (error, seleniumChild) {
self.child = seleniumChild;
if (error) {
callback(error);
return;
}
if (self.options.seleniumDebug) {
processHelper.logOutputs('selenium', self.child);
}
process.on('exit', function () {
log.debug('[chimp][selenium] process exit event detected. Stopping process');
self.stop(function () {
log.debug('[chimp][selenium] process exit event stop complete');
this._seleniumProc = await new Promise((resolve, reject) => {
selenium.start(opts, (err, child) => {
if (err) reject(err);
LOG.debug(
`Selenium server starts with PID ${child.pid}`);
resolve(child);
})
});
return true;