Running Selenium Chromedriver in Jenkins

Hi there, I’m trying to get a Selenium automated testing suite (Cucumber/Gherkin) to run in a Jenkins Automated build pipeline.

The main project is in Java, I have a Linux chromedriver which the Java project references. On build, it is failing before tests are actually run:

selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: cannot find Chrome binary

My assumption is that either of the following is true:

Either the container is not the expected base image OS, but I don’t think that is the case

or, more likely, the container does not have Chrome installed so that the Chromedriver cannot reference it. I had a similar problem when working with Azure, and had to use a Docker container in order to get Chrome to work in Selenium within the container. I tried using the same build commands in pre steps via Jenkins UI and wasn’t able as apt-get is not a relevant command, nor is apt install, nor is dnf or yum or any of the others I have tried.

What am I missing here? How can I go about accomplishing this?

Thanks!

So at this point you’ve said “I have a problem. I don’t think its a, its probably b, but not working”

can you give us any indication as to what you are running to get this? Maybe your jenkinsfile? what is the container name? at the very least, sh("cat /etc/*release*")?

In terms of environment, it’s an organization specific instance of the Jenkins web interface/dashboard and thus can modify it as needed to resolve this issue.

Regarding what we are doing to get this:

In Java, specifically Cucumber/Selenium testing service:

@Before()
public void setup() {
    System.setProperty("webdriver.chrome.driver", "linuxchromedriver");
    ChromeOptions options = new ChromeOptions();
    options.addArguments("--headless";
    driver = new ChromeDriver(options);
}

obviously driver.get(); and WebDriverWaits on driver, but the code above is quite simple, just setting up the ChromeDriver.