title: Unable to execute selenium tests on chrome browser
body: <p><strong>Local:-</strong></p>
  
  <p>I am trying to run selenium tests on chrome browser.</p>
  
  <p>Currently, another chrome browser is running and then running a test on chrome browser by opening new profile and getting the following error:-</p>
  
  <pre><code>    org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
      Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14'
      System info: host: 'lima', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-97-generic', java.version: '1.8.0_72'
      Driver info: driver.version: ChromeDriver
          at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
          at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
          at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:129)
          at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:142)
          at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:170)
          at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:138)
      at 
  Caused by: org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:19247 [localhost/127.0.0.1] failed: Connection refused
  Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14'
  System info: host: 'test', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '3.2.0-97-generic', java.version: '1.8.0_72'
  Driver info: driver.version: ChromeDriver
      at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
      ... 42 more
  Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:19247 [localhost/127.0.0.1] failed: Connection refused
      at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
      at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
      at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
      at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
      at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
      at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
      at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
      at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
      at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
      at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
      at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:143)
      at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
      at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
      at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
      ... 43 more
  Caused by: java.net.ConnectException: Connection refused
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      at java.net.Socket.connect(Socket.java:589)
      at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
      at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
      ... 56 more
  </code></pre>
  
  <p><strong>Chrome driver configuration:-</strong></p>
  
  <pre><code>   ChromeOptions options = new ChromeOptions();
          URL resource = getClass().getClassLoader().getResource("chromedriver");
          setPermissiontoFile(resource);
          System.setProperty("webdriver.chrome.driver",
                  Paths.get(resource.toURI()).toString());       
          options.addArguments("start-maximized");
          caps.setCapability(ChromeOptions.CAPABILITY, options);
          driver = new ChromeDriver(caps);
  </code></pre>
  
  <p>If I close the existing running chrome browser and then I run the selenium tests on chrome browser ,it works.</p>
  
  <p><strong>Jenkins:-</strong></p>
  
  <p>When I try to running on jenkins. I am getting the following error:-</p>
  
  <pre><code>Exception org.openqa.selenium.remote.UnreachableBrowserException
  
  Message: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure. Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14' System info: host: 'jenkins, ip: '10.62.1.24', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-504.1.3.el6.x86_64', java.version: '1.7.0_85' Driver info: driver.version: ChromeDriver
  
  Stacktrace:
  
  at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:641)
  at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
  at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:129)
  at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:142)
  at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:170)
  at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:138)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
  at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
  at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
  at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
  at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
  at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
  at org.testng.TestRunner.privateRun(TestRunner.java:782)
  at org.testng.TestRunner.run(TestRunner.java:632)
  at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
  at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
  at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
  at org.testng.SuiteRunner.run(SuiteRunner.java:268)
  at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
  at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
  at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
  at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
  at org.testng.TestNG.run(TestNG.java:1064)
  at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:178)
  at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:92)
  at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:96)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
  at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
  at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
  at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
  at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
  Caused by: org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:27419 [localhost/127.0.0.1] failed: Connection refused
  Build info: version: '2.48.0', revision: 'b7b081a4f1289f17e8ecd38bc67e137c2a12e34a', time: '2015-10-07 09:50:14'
  System info: host: 'jenkins-sandbox.qa.us-west-2.aws.vrv', ip: '10.62.1.24', os.name: 'Linux', os.arch: 'amd64', os.version: '2.6.32-504.1.3.el6.x86_64', java.version: '1.7.0_85'
  Driver info: driver.version: ChromeDriver
  at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)
  at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:620)
  ... 42 more
  Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:27419 [localhost/127.0.0.1] failed: Connection refused
  at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
  at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
  at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
  at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
  at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
  at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
  at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
  at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
  at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:143)
  at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:89)
  at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
  at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
  ... 43 more
  Caused by: java.net.ConnectException: Connection refused
  at java.net.PlainSocketImpl.socketConnect(Native Method)
  at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
  at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
  at java.net.Socket.connect(Socket.java:579)
  at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
  at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)
  ... 56 more
  </code></pre>
  
  <p>What is the problem here, Can anyone help me to solve this ? </p>