lib/options.js
function(opts) {
		var browserConfig = {}; // Defaults for browsers to be added here

		var passedBrowsers = opts.browsers || opts.browser;
		if (typeof passedBrowsers === 'undefined') {
			passedBrowsers = [{
				browserName: 'chrome',
				version: 35
			}];
		} else if (typeof passedBrowsers === 'string') {
			passedBrowsers = passedBrowsers.split(/[,;]/);
		}

		var result = [];
		passedBrowsers.forEach(function(passedBrowser) {
			passedBrowser = (typeof passedBrowser === 'string' ? {
				'browserName': passedBrowser
			} : passedBrowser);

			if (typeof browserConfig[passedBrowser.browserName] !== 'undefined') {
				var matchingBrowserCfg = browserConfig[passedBrowser.browserName] || browserConfig[passedBrowser.browserName]
				for (var key in matchingBrowserCfg) {
					if (typeof passedBrowser[key] === 'undefined') {
						passedBrowser[key] = matchingBrowserCfg[key];
					}
				}
			}
			// Add activity name for android browsers
			if (passedBrowser.browserName && passedBrowser.browserName.match(/android/gi)) {
				passedBrowser.chromeOptions = passedBrowser.chromeOptions || {};
				if (typeof passedBrowser.chromeOptions.androidPackage === 'undefined') {
					passedBrowser.chromeOptions.androidPackage = 'com.android.chrome';
				}
			}

			// Setting platform if it does not exist
			if (typeof passedBrowser.platform === 'undefined' || typeof passedBrowser.platformName === 'undefined') {
				if (opts.selenium.hostname.match(/ondemand.saucelabs.com/) || opts.selenium.hostname.match(/hub.browserstack.com/)) {
					passedBrowser.platform = 'WINDOWS';
				}
			}

			result.push(passedBrowser);
		});
		opts.browsers = result;
		return opts;
	}
function(opts) {
		var browserConfig = {}; // Defaults for browsers to be added here

		var passedBrowsers = opts.browsers || opts.browser;
		if (typeof passedBrowsers === 'undefined') {
			passedBrowsers = [{
				browserName: 'chrome',
				version: 35
			}];
		} else if (typeof passedBrowsers === 'string') {
			passedBrowsers = passedBrowsers.split(/[,;]/);
		}

		var result = [];
		passedBrowsers.forEach(function(passedBrowser) {
			passedBrowser = (typeof passedBrowser === 'string' ? {
				'browserName': passedBrowser
			} : passedBrowser);

			if (typeof browserConfig[passedBrowser.browserName] !== 'undefined') {
				var matchingBrowserCfg = browserConfig[passedBrowser.browserName] || browserConfig[passedBrowser.browserName]
				for (var key in matchingBrowserCfg) {
					if (typeof passedBrowser[key] === 'undefined') {
						passedBrowser[key] = matchingBrowserCfg[key];
					}
				}
			}
			// Add activity name for android browsers
			if (passedBrowser.browserName && passedBrowser.browserName.match(/android/gi)) {
				passedBrowser.chromeOptions = passedBrowser.chromeOptions || {};
				if (typeof passedBrowser.chromeOptions.androidPackage === 'undefined') {
					passedBrowser.chromeOptions.androidPackage = 'com.android.chrome';
				}
			}

			// Setting platform if it does not exist
			if (typeof passedBrowser.platform === 'undefined' || typeof passedBrowser.platformName === 'undefined') {
				if (opts.selenium.hostname.match(/ondemand.saucelabs.com/) || opts.selenium.hostname.match(/hub.browserstack.com/)) {
					passedBrowser.platform = 'WINDOWS';
				}
			}

			result.push(passedBrowser);
		});
		opts.browsers = result;
		return opts;
	}
function ( opts ) { var browserConfig = { } ; // Defaults for browsers to be added here var passedBrowsers = opts . browsers || opts . browser ; if ( typeof passedBrowsers === 'undefined' ) { passedBrowsers = [ { browserName : 'chrome' , version : 35 } ] ; } else if ( typeof passedBrowsers === 'string' ) { passedBrowsers = passedBrowsers . split ( / [,;] / ) ; } var result = [ ] ; passedBrowsers . forEach ( function ( passedBrowser ) { passedBrowser = ( typeof passedBrowser === 'string' ? { 'browserName' : passedBrowser } : passedBrowser ) ; if ( typeof browserConfig [ passedBrowser . browserName ] !== 'undefined' ) { var matchingBrowserCfg = browserConfig [ passedBrowser . browserName ] || browserConfig [ passedBrowser . browserName ] for ( var key in matchingBrowserCfg ) { if ( typeof passedBrowser [ key ] === 'undefined' ) { passedBrowser [ key ] = matchingBrowserCfg [ key ] ; } } } // Add activity name for android browsers if ( passedBrowser . browserName && passedBrowser . browserName . match ( / android / gi ) ) { passedBrowser . chromeOptions = passedBrowser . chromeOptions || { } ; if ( typeof passedBrowser . chromeOptions . androidPackage === 'undefined' ) { passedBrowser . chromeOptions . androidPackage = 'com.android.chrome' ; } } // Setting platform if it does not exist if ( typeof passedBrowser . platform === 'undefined' || typeof passedBrowser . platformName === 'undefined' ) { if ( opts . selenium . hostname . match ( / ondemand.saucelabs.com / ) || opts . selenium . hostname . match ( / hub.browserstack.com / ) ) { passedBrowser . platform = 'WINDOWS' ; } } result . push ( passedBrowser ) ; } ) ; opts . browsers = result ; return opts ; }
browsers
browsers