Tests fail immediately with unknown error: DevToolsActivePort file doesn't exist when running Selenium grid through systemd

Solution 1:

Thumb rule

A common cause for Chrome to crash during startup is running Chrome as root user (administrator) on Linux. While it is possible to work around this issue by passing --no-sandbox flag when creating your WebDriver session, such a configuration is unsupported and highly discouraged. You need to configure your environment to run Chrome as a regular user instead.


This error message...

OpenQA.Selenium.WebDriverException: 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: '3.9.1', revision: '63f7b50', time: '2018-02-07T22:42:28.403Z'

...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.


Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using the latest chromedriver=77.0
  • Presumably you are using chrome= 77.0.
  • Your Selenium Client version is 3.9.1 of 2018-02-07T22:42:28.403Z which is almost 1.5 years older.

So there is a clear mismatch between the Selenium Client v3.9.1 , ChromeDriver v77.0 and the Chrome Browser v77.0


Solution

Ensure that:

  • JDK is upgraded to current levels JDK 8u221.
  • Selenium is upgraded to current levels Version 3.141.59.
  • ChromeDriver is updated to current ChromeDriver v77.0 level.
  • Chrome is updated to current Chrome Version 77.0 level. (as per ChromeDriver v77.0 release notes)
  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Execute your @Test as non-root user.

Reference

You can find a couple of detailed discussions in:

  • org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser
  • unknown error: DevToolsActivePort file doesn't exist error while executing Selenium UI test cases on ubuntu

Outro

Here is the link to the Sandbox story.