I have an ubuntu server having the UI as well. U can execute the test cases by firing mvn test command. But the problem is when I do ssh of the machine through the terminal from another machine I get the following error-
unknown error: DevToolsActivePort file doesn't exist
(Driver info: chromedriver=2.40.565383 (76257d1ab79276b2d53ee976b2c3e3b9f335cde7),platform=Linux 4.4.0-121-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.04 seconds
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'ubuntu-test', ip: 'X.X.X.X', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-121-generic', java.version: '1.8.0_171'
Driver info: driver.version: ChromeDriver
but the same command starts chrome successfully if I take remote of the machine through remmina and then execute the same command of this machines terminal.
I had a similar issue when I was trying to selenium UI test cases in headless mode. This occurred as I did not have a display server. Starting Xvfb worked for me.
sudo yum -y install Xvfb libXfont Xorg
sudo yum -y groupinstall "X Window System" "Desktop" "Fonts" "General Purpose Desktop"
Xvfb :99 -screen 0 1024x768x24 &
export DISPLAY=:1
This error message...
...implies that the ChromeDriver was unable to initiate/spawn a new WebBrowser i.e. Chrome Browser session.
Your code trials and the versioning information of all the binaries would have given us some hint about what's going wrong.
However as per Add --disable-dev-shm-usage to default launch flags seems adding the argument
--disable-dev-shm-usage
will temporary solve the issue.If you desire to initiate/span a new Chrome Browser session you can use the following Java solution:
disable-dev-shm-usage
As per base_switches.cc
disable-dev-shm-usage
seems to be valid only on Linix OS:In the discussion Add an option to use /tmp instead of /dev/shm David mentions:
You can also find a detailed discussion in org.openqa.selenium.WebDriverException: unknown error: DevToolsActivePort file doesn't exist while trying to initiate Chrome Browser
Try to running selenium-server without
sudo
-privileges:java -jar path/to/selenium-server-standalone.jar
Simply use headless mode
If you run from ssh without an X-forward your chrome browser will crash. To prevent that you can use the options DebanjanB posted, the most important being --headless. If running as root ( not recommended ) you need --no-sandbox as well.
I also had this error when I used al older version of selenium-java (3.5.3) with the newer chromedriver (75.x). It worked for me to use the 2.46 version of the chromedriver with the 3.5.3, or the 75.x with 3.141.59 of selenium java.
Running a local Xvfb should work too, but I suggest to use headless, it can be much faster.
Check the suggested duplicate post to and please update and mark as solved whatever helped you.
I use this configuration using python