0

I'm running Selenium tests for Chrome through Jenkins pipeline on CentOs machine. When ran, it gives following error -

org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
   [testng]   (unknown error: DevToolsActivePort file doesn't exist)
   [testng]   (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

However if I run same tests with same command(which is used through Jenkins pipeline) from that machine locally, it succeeds.

For the same, I went through link1, link2, link3 and other answers. From those answers, only following helped -

chrome_options.add_argument('--headless')

But this run tests with chrome in headless mode which is not my intention.

In my case, having matching Chrome browser and chromedriver version did not help, also Chrome has executable permission for all.

Note: I've my CentOs machine display enabled

Could you please help to understand what is causing this failure? Also please help with what code and/or machine level changes I've to make for its success.

EDIT:

In case, this helps to get more info.

ls | grep 'chrome' under /usr/bin gave following result -

lrwxrwxrwx 1 root root          31 Jan 20 12:29 google-chrome -> /etc/alternatives/google-chrome
lrwxrwxrwx 1 root root          32 Jan 20 12:29 google-chrome-stable -> /opt/google/chrome/google-chrome
Alpha
  • 13,320
  • 27
  • 96
  • 163

1 Answers1

-1

Do you run chromedriver locally on a linux machine? What version of CentOS are you using? If you haven't already you need to install the correct chromedriver for linux. As far as I know if you want to run via Jenkins you have to run in headless mode. But I may be wrong. Below is another post that can help:

Steps to Install and run headless chrome browser on centos 6.5 using chrome driver

Below are my own settings for chrome options:

options.addArguments("--headless");
options.addArguments("--disable-dev-shm-usage");
options.addArguments("--allow-insecure-localhost");
options.addArguments("--window-size=1920,1080");
options.addArguments("start-maximized");
options.addArguments("enable-automation");
options.addArguments("--disable-infobars");
options.addArguments("--disable-browser-side-navigation");
options.addArguments("--disable-gpu");
options.addArguments("--no-sandbox");
options.addArguments("--force-device-scale-factor=1");
David M
  • 84
  • 5