Skip to content
Advertisement

cannot find Chrome binary error on Jenkins using maven and WebDriverManager

I’m trying to run my test (Selenium+junit+cucumber+Maven) on Jenkins. In my definition class I’m not pointing to Chrome binary but rather use WebDriverManager:

@Given(“^I navigate to page$”)

JavaScript

It works fine on my machine (Win), but when I’m trying to execute this on Jenkins (Ubuntu box), I get error:

org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary (Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.4.0-1047-aws x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 687 milliseconds Build info: version: ‘2.48.2’, revision: ’41bccdd10cf2c0560f637404c2d96164b67d9d67′, time: ‘2015-10-09 13:08:06’ System info: host: ‘ip-172-31-12-150’, ip: ‘172.31.12.150’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.4.0-1047-aws’, java.version: ‘1.8.0_151’ Driver info: org.openqa.selenium.chrome.ChromeDriver at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:129) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:170) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:159) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:116) at GridTest.grid.StepDef.i_navigate_to_webpage(StepDef.java:52) at ✽.Given I navigate to page(src/test/test.feature:6)

I was under impression that WebDriverManager should have covered that how it does on my Windows machine. Isn’t it so?

My Pom.xml file here:

JavaScript

Advertisement

Answer

Your chrome on Ubuntu is not installed into default location:

enter image description here

More detail

you can add the chrome binary to PATH environent variable or reinstall it to default location.

Make sure chromedriver compatible with chrome browser, check this link to get compatible mapping

Chromedriver 2.35 Supports Chrome v62-64

When run script from Linux terminal tunnel, like run by Jenkins. In general, Linux terminal tunnel not have display screen, but run script with headful model require a physical or virtual display.

Option 1: run with headless model when not setup virtual display by xWindow/xvbf

JavaScript

Option 2: run with headful model, but need setup virtual display for the user which Jenkins used to connect to your Ubuntu box or you setup for all users if you can’t know which user.

Please read document about Xvbf or other xWindow to setup virtual display.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement