title: unknown error: DevTools Active Port file doesn't exist java selenium
body: <p>I am new to Selenium with Java. Followed online tutorial and tried executing the below code but am getting error message</p>
  
  <blockquote>
    <p>unknown error: DevTools Active Port file doesn't exist java selenium.</p>
  </blockquote>
  
  <p>I surfed on google and added the options arguments but nothing works.       </p>
  
  <pre><code>package mainfiles;
  
  import org.openqa.selenium.WebDriver;
  import org.openqa.selenium.chrome.ChromeDriver;
  import org.openqa.selenium.chrome.ChromeOptions;
  
  public class MainClass {
  
      static WebDriver driver;        
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  
          System.setProperty("webdriver.chrome.driver", "E:\\Selenium\\Latest jar files\\chromedriver.exe");
          ChromeOptions options = new ChromeOptions();
          //options.setExperimentalOption("useAutomationExtension", false);
          options.addArguments("--headless");
          options.addArguments("--disable-extensions"); // disabling extensions
          options.addArguments("--disable-gpu"); // applicable to windows os only
          options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
          options.addArguments("--no-sandbox");
          driver =new ChromeDriver();
          driver.get("www.gmail.com");
          }
  
  }
  </code></pre>
  
  <p>When i run this program, I am getting the below error </p>
  
  <pre><code>Starting ChromeDriver 2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab) on port 36409
  Only local connections are allowed.
  Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist
    (Driver info: chromedriver=2.40.565498 (ea082db3280dd6843ebfb08a625e3eb905c4f5ab),platform=Windows NT 10.0.10240 x86_64) (WARNING: The server did not provide any stacktrace information)
  Command duration or timeout: 60.13 seconds
  Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:14.902Z'
  System info: host: 'DESKTOP-6O850P3', ip: '172.20.10.3', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171'
  Driver info: driver.version: ChromeDriver
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
      at java.lang.reflect.Constructor.newInstance(Unknown Source)
      at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
      at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
      at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
      at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
      at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
      at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
      at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
      at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
      at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
      at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
      at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
      at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
      at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
      at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
      at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
      at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
      at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
      at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
      at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212)
      at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:130)
      at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:181)
      at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:168)
      at org.openqa.selenium.chrome.ChromeDriver.&lt;init&gt;(ChromeDriver.java:123)
      at mainfiles.MainClass.main(MainClass.java:22)
  </code></pre>