Use Chrome WebDriver with Google ChromeDriver

Q

How to use Chrome WebDriver with Google ChromeDriver WebDriver server?

✍: FYIcenter.com

A

If you are using the Chrome WebDriver with the Selenium Java API, and you want to override the default Google ChromeDriver, you need to set the webdriver.chrome.driver system property to the path to the Google ChromeDriver driver as shown below.

1. Make sure that you have Google ChromeDriver WebDriver Server installed:

C:\fyicenter>dir \fyicenter\selenium\chromedriver
         8,393,728 chromedriver.exe

2. Set the webdriver.chrome.driver system property to the ChromeDriver server program path and run the test again.

C:\fyicenter> java -classpath \
   .;\fyicenter\selenium\java\client-combined-3.141.59.jar;\
   .;\fyicenter\selenium\java\client-combined-3.141.59.jar;\
   \fyicenter\selenium\java\libs\guava-25.0-jre.jar;\
   \fyicenter\selenium\java\libs\okhttp-3.11.0.jar;\
   \fyicenter\selenium\java\libs\okio-1.14.0.jar;\
   \fyicenter\selenium\java\libs\commons-exec-1.3.jar \
   -Dwebdriver.chrome.driver=\fyicenter\selenium\chromedriver\chromedriver.exe \
   ChromeTest

Starting ChromeDriver 76.0.3809.12 (...-refs/branch-heads/3809@{#83}) on port 48877
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks 
to prevent access by malicious code.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: session not created: 
   This version of ChromeDriver only supports Chrome version 76
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '12.0.1'
Driver info: driver.version: ChromeDriver
remote stacktrace: Backtrace:
   Ordinal0 [0x014E7723+1472291]
   ...

As you can see, we are getting a different error: "This version of ChromeDriver only supports Chrome version 76". So we need update Google Chrome to version 76 to match ChromeDriver version. See next tutorial on how to fix it.

 

Match Google ChromeDriver version with Chrome

Chrome WebDriver Test with Selenium Java API

Starting with Selenium WebDriver Client Java API

⇑⇑ Selenium Tutorials

2020-02-07, 1580🔥, 0💬