(unknown error: DevToolsActivePort file doesn't exist)

1,382 views
Skip to first unread message

James

unread,
Dec 31, 2021, 1:32:30 AM12/31/21
to ChromeDriver Users

I see that this problem has occurred a few times for people, but sadly for me, I have not been able to fix it.... yet.  My guess is that I am doing something rather obvious for it to not work  ( well, obvious to most  others I suspect ).

I get the " Invalid --log-level value." and the   (unknown error: DevToolsActivePort file doesn't exist)

Happy and safe new year everyone.

          ------------------------------------------------------


os: Debian GNU/Linux 10 (buster)

Openjdk version "11.0.9.1" 2020-11-04

OpenJDK Runtime Environment (build 11.0.9.1+1-post-Debian-1deb10u2)

OpenJDK 64-Bit Server VM (build 11.0.9.1+1-post-Debian-1deb10u2, mixed mode, sharing)

Selenium:  selenium-server-4.1.1.jar

ChromeDriver:  96.0.4664.45 (76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947})

-------------------------------------------------------------

import java.io.*;

import java.util.*;


import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.*;

import org.openqa.selenium.chrome.ChromeDriver.*;


import org.openqa.selenium.internal.Require;

import org.openqa.selenium.remote.http.ClientConfig;


import org.openqa.selenium.remote.http.*;

import org.openqa.selenium.remote.*;


import org.slf4j.Logger;

import org.slf4j.LoggerFactory;


public class Chrome 

{

    static public void main( String[] args )

    {

            Logger logger = LoggerFactory.getLogger( Chrome.class );

            logger.info("Hello Chrome");


            System.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");

            System.setProperty("webdriver.chrome.logfile", "/home/james/chrome/chrome.logs");

            System.setProperty("webdriver.chrome.verboseLogging", "true");


            ChromeOptions options = new ChromeOptions();

            options.addArguments("--no-sandbox"); 

            options.addArguments("--headless");

            options.addArguments("--disable-logging");

            options.addArguments("--output=/home/james/chrome.logs");

            options.addArguments("--disable-dev-shm-usage"); 

            options.addArguments("--usr-data-dir=/home/james/chrome_data.logs");

            options.addArguments("--disable-logging");


            System.out.println("   -----> create new ChromeDriver");

            WebDriver driver = new ChromeDriver( options );

            driver.quit();


    } // end of main

}

-----------------------------------------


Server A james:~/chrome [2057]$ java Chrome


Dec 31, 2021 4:15:36 PM Chrome main

INFO: Hello Chrome

   -----> create new ChromeDriver

Starting ChromeDriver 96.0.4664.45 (76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947}) on port 51510

Only local connections are allowed.

Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.

ChromeDriver was started successfully.

Starting ChromeDriver 96.0.4664.45 (76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947}) on port 9515

Only local connections are allowed.

Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.

Invalid --log-level value.

Unable to initialize logging. Exiting...

Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: Chrome failed to start: exited abnormally.

  (unknown error: DevToolsActivePort file doesn't exist)

  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

Build info: version: '4.1.1', revision: 'e8fcc2cecf'

System info: host: 'localhost', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.0-13-amd64', java.version: '11.0.9.1'

Driver info: org.openqa.selenium.chrome.ChromeDriver

Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [--no-sandbox, --headless, --disable-logging, --output=/home/james/chrome..., --disable-dev-shm-usage, --usr-data-dir=/home/james/..., --disable-logging], extensions: []}}], desiredCapabilities=Capabilities {browserName: chrome, goog:chromeOptions: {args: [--no-sandbox, --headless, --disable-logging, --output=/home/james/chrome..., --disable-dev-shm-usage, --usr-data-dir=/home/james/..., --disable-logging], extensions: []}}}]

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)

at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:62)

at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:156)

at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:164)

at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:139)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:560)

at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)

at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:169)

at org.openqa.selenium.chromium.ChromiumDriver.<init>(ChromiumDriver.java:108)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:104)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:91)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:80)

at Chrome.main(Chrome.java:42)


-----------------------------------------


Server A james:~/chrome [2061]$ cat chrome.logs

[1640927737.817][INFO]: Starting ChromeDriver 96.0.4664.45 (76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch-heads/4664@{#947}) on port 51510

[1640927737.817][INFO]: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.

[1640927738.161][INFO]: [586cdb030f209219757203b81376ae9e] COMMAND InitSession {

   "capabilities": {

      "firstMatch": [ {

         "browserName": "chrome",

         "goog:chromeOptions": {

            "args": [ "--no-sandbox", "--headless", "--disable-logging", "--output=/home/james/chrome.logs", "--disable-dev-shm-usage", "--usr-data-dir=/home/james/chrome_data.logs", "--disable-logging" ],

            "extensions": [  ]

         }

      } ]

   },

   "desiredCapabilities": {

      "browserName": "chrome",

      "goog:chromeOptions": {

         "args": [ "--no-sandbox", "--headless", "--disable-logging", "--output=/home/james/chrome.logs", "--disable-dev-shm-usage", "--usr-data-dir=/home/james/chrome_data.logs", "--disable-logging" ],

         "extensions": [  ]

      }

   }

}

[1640927738.162][INFO]: Populating Preferences file: {

   "alternate_error_pages": {

      "enabled": false

   },

   "autofill": {

      "enabled": false

   },

   "browser": {

      "check_default_browser": false

   },

   "distribution": {

      "import_bookmarks": false,

      "import_history": false,

      "import_search_engine": false,

      "make_chrome_default_for_user": false,

      "skip_first_run_ui": true

   },

   "dns_prefetching": {

      "enabled": false

   },

   "profile": {

      "content_settings": {

         "pattern_pairs": {

            "https://*,*": {

               "media-stream": {

                  "audio": "Default",

                  "video": "Default"

               }

            }

         }

      },

      "default_content_setting_values": {

         "geolocation": 1

      },

      "default_content_settings": {

         "geolocation": 1,

         "mouselock": 1,

         "notifications": 1,

         "popups": 1,

         "ppapi-broker": 1

      },

      "password_manager_enabled": false

   },

   "safebrowsing": {

      "enabled": false

   },

   "search": {

      "suggest_enabled": false

   },

   "translate": {

      "enabled": false

   }

}

[1640927738.162][INFO]: Populating Local State file: {

   "background_mode": {

      "enabled": false

   },

   "ssl": {

      "rev_checking": {

         "enabled": false

      }

   }

}

[1640927738.162][INFO]: Launching chrome: /usr/bin/google-chrome --allow-pre-commit-input --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-dev-shm-usage --disable-hang-monitor --disable-logging --disable-popup-blocking --disable-prompt-on-repost --disable-sync --enable-automation --enable-blink-features=ShadowDOMV0 --enable-logging --headless --log-level=0 --no-first-run --no-sandbox --no-service-autorun --output=/home/james/chrome.logs --password-store=basic --remote-debugging-port=0 --test-type=webdriver --use-mock-keychain --user-data-dir=/tmp/.com.google.Chrome.7DfgOS --usr-data-dir=/home/james/chrome_data.logs data:,

[1640927738.217][INFO]: [586cdb030f209219757203b81376ae9e] RESPONSE InitSession ERROR unknown error: Chrome failed to start: exited abnormally.

  (unknown error: DevToolsActivePort file doesn't exist)

  (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

[1640927738.217][DEBUG]: Log type 'driver' lost 0 entries on destruction

[1640927738.217][DEBUG]: Log type 'browser' lost 0 entries on destruction


------------------------------------------------------


Mandheer Maan

unread,
Jul 8, 2022, 11:43:39 AM7/8/22
to ChromeDriver Users
Hi Dear,

I was just going through this issue and fixed this issue using the following chromeOptions :

        ChromeOptions chromeOptions = new ChromeOptions();
        chromeOptions.setBinary("/opt/chrome/chrome");
        chromeOptions.addArguments("--headless");                  
        chromeOptions.addArguments("--no-sandbox");                
        chromeOptions.addArguments("--single-process");            
        chromeOptions.addArguments("--disable-dev-shm-usage");
        driver = new ChromeDriver(chromeOptions);   

Hope so this information will be valuable for you !!!
Have a nice Day !!!

Thanks & Regards,
Mandheer Singh Maan
Senior Automation Tester

Reply all
Reply to author
Forward
0 new messages