Skip to content

Instantly share code, notes, and snippets.

@JLarky
Created December 27, 2014 04:13
Show Gist options
  • Save JLarky/332595b1aeaf0c428968 to your computer and use it in GitHub Desktop.
Save JLarky/332595b1aeaf0c428968 to your computer and use it in GitHub Desktop.
protractor config file you can use without `webdriver-manager start` or `gulp webdriver_standalone`
var findSeleniumJar = function(dir) {
var fs = require('fs');
var _ = require('underscore');
var files = fs.readdirSync(dir);
var found;
var count = 0;
_.each(files, function (file) {
if (file.match('^selenium-server-standalone-(.+)\.jar$')) {
count++;
found = file;
}
})
if (count == 0) {
console.error('No version of selenium driver was found. Run `webdriver-manager update`')
return;
}
else if (count > 1) {
console.log("Multiple versions of selenium driver found. Using " + found)
}
return fs.realpathSync(dir) + '/' + found
}
exports.config = {
// seleniumAddress: 'http://localhost:4444/wd/hub'
seleniumServerJar: findSeleniumJar('./node_modules/protractor/selenium')
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment