selenium-standalone
Advanced tools
Comparing version 2.43.1-2.9.0-1 to 2.43.1-3
@@ -14,4 +14,9 @@ var path = require('path'); | ||
// see http://chromedriver.storage.googleapis.com/index.html | ||
v: '2.9' | ||
v: '2.10' | ||
}, | ||
ieDr: { | ||
path: path.join(__dirname, '.selenium', version, 'IEDriverServer.exe'), | ||
// see http://selenium-release.storage.googleapis.com/index.html | ||
v: '2.43.0' | ||
} | ||
}; | ||
}; |
@@ -5,2 +5,3 @@ var spawn = require('child_process').spawn; | ||
var whereis = require( 'whereis' ); | ||
var path = require( 'path' ); | ||
@@ -26,4 +27,10 @@ module.exports = standalone; | ||
'-Dwebdriver.chrome.driver=' + conf.chromeDr.path | ||
].concat(seleniumArgs); | ||
]; | ||
if (process.platform === 'win32') { | ||
args.push('-Dwebdriver.ie.driver=' + conf.ieDr.path); | ||
} | ||
args = args.concat(seleniumArgs); | ||
var selenium = spawn('java', args, spawnOptions); | ||
@@ -30,0 +37,0 @@ |
@@ -1,7 +0,10 @@ | ||
var conf = require('./conf.js'); | ||
var async = require('async'); | ||
var fs = require('fs'); | ||
var mkdirp = require('mkdirp'); | ||
var rimraf = require('rimraf'); | ||
var path = require('path'); | ||
var util = require('util'); | ||
var conf = require('./conf.js'); | ||
async.series([ | ||
@@ -21,6 +24,12 @@ setup, | ||
function download(cb) { | ||
async.parallel([ | ||
var steps = [ | ||
installChromeDr.bind(null, conf.chromeDr.path, conf.chromeDr.v), | ||
installSelenium.bind(null, conf.selenium.path, conf.selenium.v) | ||
], cb) | ||
]; | ||
if (process.platform === 'win32') { | ||
steps.push(installIeDr.bind(null, conf.ieDr.path, conf.selenium.v, conf.ieDr.v)); | ||
} | ||
async.parallel(steps, cb); | ||
} | ||
@@ -39,3 +48,3 @@ | ||
var dl = require('util').format(seleniumStandaloneUrl, | ||
var dl = util.format(seleniumStandaloneUrl, | ||
version.slice(0, version.lastIndexOf('.')), | ||
@@ -50,3 +59,3 @@ version); | ||
stream | ||
.pipe(require('fs').createWriteStream(to)) | ||
.pipe(fs.createWriteStream(to)) | ||
.once('error', cb.bind(null, new Error('Could not write to ' + to))) | ||
@@ -59,9 +68,6 @@ .once('finish', cb); | ||
console.log('chmod+x chromedriver'); | ||
require('fs').chmod(where, 0755, cb); | ||
fs.chmod(where, 0755, cb); | ||
} | ||
function installChromeDr(to, version, cb) { | ||
var path = require('path'); | ||
var util = require('util'); | ||
var chromedriverUrl = 'http://chromedriver.storage.googleapis.com/%s/chromedriver_%s.zip'; | ||
@@ -76,3 +82,25 @@ var platform = getChromeDriverPlatform(); | ||
getDownloadStream(downloadUrl, function(err, stream) { | ||
installZippedFile(to, downloadUrl, cb); | ||
} | ||
function installIeDr(to, seleniumVersion, version, cb) { | ||
var ieDriverUrl = 'http://selenium-release.storage.googleapis.com/%s/IEDriverServer_%s_%s.zip'; | ||
var platform = getIeDriverPlatform(); | ||
if (platform instanceof Error) { | ||
return cb(platform); | ||
} | ||
var downloadUrl = util.format( | ||
ieDriverUrl, | ||
// | ||
seleniumVersion.slice(0, version.lastIndexOf('.')), | ||
platform, | ||
version | ||
); | ||
installZippedFile(to, downloadUrl, cb); | ||
} | ||
function installZippedFile(to, url, cb) { | ||
getDownloadStream(url, function(err, stream) { | ||
if (err) { | ||
@@ -84,13 +112,13 @@ return cb(err); | ||
console.log('Unzipping ' + downloadUrl); | ||
console.log('Unzipping ' + url); | ||
stream | ||
.pipe(require('unzip').Parse()) | ||
.pipe(unzip.Parse()) | ||
.once('entry', function(file) { | ||
file | ||
.pipe(require('fs').createWriteStream(to)) | ||
.pipe(fs.createWriteStream(to)) | ||
.once('error', cb.bind(null, new Error('Could not write to ' + to))) | ||
.once('finish', cb) | ||
}) | ||
.once('error', cb.bind(null, new Error('Could not unzip ' + downloadUrl))) | ||
.once('error', cb.bind(null, new Error('Could not unzip ' + url))) | ||
}) | ||
@@ -100,2 +128,4 @@ } | ||
function getDownloadStream(downloadUrl, cb) { | ||
var http = require('http'); | ||
var proxy = process.env.HTTP_PROXY || process.env.http_proxy; | ||
@@ -118,3 +148,3 @@ | ||
var r = | ||
require('http') | ||
http | ||
.request(requestOpts, function(res) { | ||
@@ -154,2 +184,12 @@ console.log('Downloading ' + downloadUrl, res.statusCode); | ||
return platform; | ||
} | ||
} | ||
function getIeDriverPlatform() { | ||
if (process.arch === 'ia32') { | ||
return 'Win32'; | ||
} else if (process.arch === 'x64') { | ||
return 'x64'; | ||
} else { | ||
return new Error('Architecture not supported'); | ||
} | ||
} |
{ | ||
"name": "selenium-standalone", | ||
"version": "2.43.1-2.9.0-1", | ||
"version": "2.43.1-3", | ||
"description": "installs a `start-selenium` command line to start a standalone selenium server with chrome-driver", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,8 +7,8 @@ # selenium-standalone | ||
Command line or programmatic install and launch of latest selenium standalone | ||
server and chrome driver. | ||
Command line or programmatic install and launch of latest [selenium](http://www.seleniumhq.org/download/) standalone | ||
server, [chrome driver](https://code.google.com/p/selenium/wiki/ChromeDriver) and [internet explorer driver](https://code.google.com/p/selenium/wiki/InternetExplorerDriver). | ||
It will install a `start-selenium`. | ||
It will install a `start-selenium` command line that will be able to launch firefox, chrome, internet explorer or phantomjs for your tests. | ||
Currently installs selenium `2.43.1` and chrome driver `2.9`. | ||
Currently installs selenium `2.43.1`, chrome driver `2.10` and internet explorer driver `2.43.0`. | ||
@@ -15,0 +15,0 @@ ```shell |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11916
233
3