0
votes

I have a WebDriver 3.5 based testsuite written in Java. It is working well when I execute it from IntelliJ IDEA. I get following error message, when I build it in Jenkins.

org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary (Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Windows NT 6.3.9600 x86_64) (WARNING: The server did not provide any stacktrace information)

System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe");
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
driver = new ChromeDriver(chromeOptions);

No Chrome binary is needed to execute it from IDE. Jenkins is installed on the same machine as IntelliJ IDEA.

2

2 Answers

2
votes

Jenkins executes tests against Headless browsers like PhantomJs. The complaint is that Jenkins can't find the chrome browser binary. Take a look at switching to PhantomJs or take a look at Getting started with headless chrome.

0
votes

I am working on windows 10, Chrome version 80. I have installed chrome driver compatible with chrome version 80. When I was running the selenium code in eclipse, it was giving error "org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary"

So, I have uninstalled all other version of chrome I was having except chrome versio 80 but it didn't work.

For resolving this issue we have to set path for Chrome binary. Use setBinary function for setting the path of your chrome executable file and Use setProperty for setting the path of chrome driver. Please see the image attached