title: chromedriver fails on windows jenkins slave running in foreground
body: <p>Is there a trick to getting Win Jenkins slave to be OK with chromedriver?</p>
  
  <p>My tests pull chromedriver and portable chrome from a maven repo and then execute them.  The work fine on my local and when my build users does the same on my build systems.</p>
  
  <p>When jenkins does the same thing, even when running in the foreground (not a svc) it fails with the error below.  I've tried passing params to boost the verbosity to no avail.</p>
  
  <blockquote>
    <p>org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited normally
      (Driver info: chromedriver=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 62.63 seconds
    Build info: version: '2.41.0', revision: '3192d8a6c4449dc285928ba024779344f5423c58', time: '2014-03-27 11:29:39'
    System info: host: 'winengbld15', ip: '10.2.2.105', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_40'
    Driver info: org.openqa.selenium.chrome.ChromeDriver
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
        at org.openqa.selenium.chrome.ChromeDriver.startSession(ChromeDriver.java:181)
        at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:126)
        at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:139)
        at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:160)
        at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:128)</p>
  </blockquote>
  
  <p>I setup the Chrome driver thus:</p>
  
  <pre><code>defaultPath = "target/drivers/chromedriver.exe";
  System.setProperty("webdriver.chrome.driver", defaultPath);
  ChromeLocator locator = new ChromeLocator();
  driver = new ChromeDriver(locator.getCapabilities());
  
  public class ChromeLocator {
    private static final Logger log = Logger.getLogger(ChromeLocator.class);
  
    /**
     * Obtain Chrome Configuration with location of binary
     * @return
     * @throws IOException 
     */
    public DesiredCapabilities getCapabilities() throws IOException {
      Map&lt;String, Object&gt; chromeOptions = new HashMap&lt;String, Object&gt;();
      chromeOptions.put("binary", getChromeExecutableLocation().getAbsolutePath());
  
      DesiredCapabilities capabilities = DesiredCapabilities.chrome();
      capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
  
      return capabilities;
    }
  
    // Windows defaults to unpacked location
    private File getChromeExecutableLocation() throws IOException {
  
      File chromeExe;
  
      if (SystemUtils.IS_OS_WINDOWS) {
        chromeExe = new File(System.getProperty("win.google.chrome.bin"));  
        log.info("*** win.google.chrome.bin: " + System.getProperty("win.google.chrome.bin"));
      } else {
        // Use the standard locator option for all other operating systems
        GoogleChromeLocator locator = new GoogleChromeLocator();
        BrowserInstallation installation = locator.findBrowserLocationOrFail();
        chromeExe = new File(installation.launcherFilePath());
      }
      log.info("Chrome Exe: " + chromeExe.getAbsolutePath() + " Is File: " + chromeExe.isFile());
      if (! chromeExe.exists() || ! chromeExe.isFile()) {
        throw new IOException("Cannot locate Chrome Executable.  Expected Location: " + chromeExe.getAbsolutePath());
      }
      return chromeExe;
    }
  }
  </code></pre>