Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function startSelenium(callback) {
// Start selenium
var opts = {};
selenium.install(opts, function(err) {
if (err) {
console.error('Failed to install selenium', err);
process.exit(1);
}
selenium.start(opts, function(err, server) {
sauceClient = wd.promiseChainRemote();
callback();
});
});
}
function startSelenium(callback) {
// Start selenium
var opts = {version: '2.45.0'};
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) {
// Start selenium
var opts = {version: '2.42.0'};
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();
});
});
}
// check for more recent versions of selenium here:
// https://selenium-release.storage.googleapis.com/index.html
// 2.39.0 is the latest one to support java 7 (installed by default on most linux distros)
version: '2.39.0',
baseURL: 'https://selenium-release.storage.googleapis.com',
drivers: {
chrome: {
// check for more recent versions of chrome driver here:
// https://chromedriver.storage.googleapis.com/index.html
version: '2.27',
arch: process.arch,
baseURL: 'https://chromedriver.storage.googleapis.com'
}
}
};
selenium.install(seleniumConfig, function() {
selenium.start(seleniumConfig, function(err, child) {
return gulp.src('')
.pipe(nightwatch({
configFile: 'nightwatch.json'
}))
.on('end', function() {
setTimeout(function() {
child.kill();
browserSync.exit();
}, 500);
});
});
});
}
};
function startSelenium(callback, manualStop) {
callback = callback || function() {}
var selenium = require('selenium-standalone')
var drivers = {
chrome: {
version: '2.38',
arch: process.arch,
baseURL: 'https://chromedriver.storage.googleapis.com'
},
firefox: {
version: '0.19.1',
arch: process.arch
}
}
selenium.install(
{
logger: console.log,
drivers
},
function(installError) {
if (installError) {
console.log('Error while installing selenium:', installError)
}
selenium.start({ drivers }, function(startError, child) {
function killSelenium() {
child.kill()
console.log('Just killed selenium!')
}
if (startError) {
console.log('Error while starting selenium:', startError)
return process.exit(1)
//set handler
server.on('request', requestHandler);
isAmazonLinux && secureServer.on('request', requestHandler);
//listen server
switch(process.env.SV_ENV) {
case 'amazonLinux':
server.listen(port, callbackAfterServerListening);
secureServer.listen(securePort, callbackAfterServerListening);
break;
default:
selenium.install(seleniumOptions, function(err) {
console.log('Selenium is installed.');
if(err) {
console.error(err);
}
selenium.start(seleniumOptions, function(err, child) {
console.log('Selenium is running.');
if(err) {
console.error(err);
}
//child.kill();
child.stderr.on('data', function(data){
console.log(data.toString());
});
server.listen(port, callbackAfterServerListening);
});
});
await new Promise((resolve, reject) => {
selenium.install(opts, err => {
if (err) reject(err);
LOG.debug("Selenium drivers are installed");
resolve();
});
});
},