function getRemoteWebDriver(browser) {
  var builder = /** @type {!WebDriverBuilder} */ (new webdriver.Builder());
  builder.usingServer('http://' +
      process.env['SAUCE_USERNAME'] + ':' + process.env['SAUCE_ACCESS_KEY'] +
      '@ondemand.saucelabs.com:80/wd/hub');
  builder.disableEnvironmentOverrides();

  var caps = {
    'name': browser + ' ' + (process.env['TRAVIS_JOB_NUMBER'] || 'pilot'),
    'username': process.env['SAUCE_USERNAME'],
    'accessKey': process.env['SAUCE_ACCESS_KEY'],
    'tunnelIdentifier': process.env['TRAVIS_JOB_NUMBER'],
    'maxDuration': 3600,
    'loggingPrefs': {
      'browser': 'ALL'
    }
  };
  switch (browser) {
    case 'chrome':
      caps['browserName'] = 'chrome';
      caps['platform'] = 'linux';
      break;

    case 'firefox':
      caps['browserName'] = 'firefox';
      caps['platform'] = 'linux';
      break;

    case 'safari':
      caps['browserName'] = 'safari';
      caps['platform'] = 'OS X 10.11';
      caps['version'] = '10.0';
      break;

    case 'ie':
      caps['browserName'] = 'internet explorer';
      caps['platform'] = 'Windows 7';
      caps['version'] = '11.0';
      break;

    default:
      throw new Error('Unsupported browser');
      break;
  }

  return builder.withCapabilities(caps).build();
}
/*_test.js').map(
      function(fileName) {
        var prefixLength = testFolder.length + 1;
        return fileName.substr(prefixLength);
      }).filter(
      function(fileName) {
        var hasPositivePattern = positivePatterns.length == 0 ||
            hasPattern(fileName, positivePatterns);
        var hasNegativePattern = hasPattern(fileName, negativePatterns);
        return testPrefix == null ? true :
            (hasPositivePattern && !hasNegativePattern);
      }).map(
      function(fileName) {
        return fileName.replace(/\.js$/, '.html');
      });

  return relativeTestUrls.map(
      function(url) {
        return 'http://localhost:8000/html/' + url;
      });
}


/**
TODO(arthurhsu): Safari will timeout when called. Need investigation.
@param {string} browser
@return {!WebDriver}