org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary - While Running Through Jenkins

[INFO] --- maven-surefire-plugin:2.20.1:test (default-test) @ Maven.Final ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
Starting ChromeDriver 2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f) on port 32967
Only local connections are allowed.
FAILED CONFIGURATION: @BeforeClass setUp
org.openqa.selenium.WebDriverException: unknown error: cannot find Chrome binary
  (Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 10.0.15063 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 54 milliseconds
Build info: version: '3.7.1', revision: '8a0099a', time: '2017-11-06T21:01:39.354Z'
System info: host: 'XXXXXXXXXX', ip: 'XXXXXXXXXXX', os.name: 'Windows 10', os.arch: 'XXXXXX', os.version: '10.0', java.version: '1.8.0_131'
Driver info: driver.version: 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:214)


Let see how to resolve this problem, if we run our project through intellj or eclipse using TestNG or Maven our Script will work fine but when we try to run this using Jenkins the Jenkins could not access the binary from our system, since It is possible that chrome is installed on your AppData folder in C drive, so we need to be sure that jenkins is able to access our chrome binary file.


Now to access the binary file we need to add below snippet


ChromeOptions chromeOptions= new ChromeOptions();
chromeOptions.setBinary("C:\\Users\\Manish\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe");
 System.setProperty("webdriver.chrome.driver","C:\\Users\\manish\\Downloads\\chromedriver_win32\\chromedriver.exe");
 driver = new ChromeDriver(chromeOptions);


i hope this resolve your problem let me know if this won't work for you guys.

  1. Unknown said...

    It helps ,Thank you

  2. Unknown said...

    hi thanks for this solution but i got same issue on jenkins
    server

  3. Unknown said...

    same error still occurs after using chromeOptions for binary... Runs fine on local system in eclipse but having issue on jenkins where I integrated jenkins with Git and committing code from eclipse to git.

  4. Unknown said...

    Worked for me thanks

  5. Jay said...

    It helps ,Thank you

  6. Unknown said...

    Thanks .it working fine

Post a Comment