Java

Goodbye “This version of ChromeDriver only supports Chrome version**”, hello #chromeDriverInstaller #selenium

Tired of getting "This version of ChromeDriver only supports Chrome version**"?
It’s an error message indicates that the version of your ChromeDriver is incompatible with the current version of Chrome.

In that case, you need to find the compatible version from the site, download the archive, place the driver into an appropriate location.
chrome-driver-instlaller is a tiny Java utility that gets rid of the boring task.

Using chrome-driver is as is as just placing the following code:

Optional path = com.samuraism.chromedriverinstaller.ChromeDriverInstaller.ensureInstalled("/tmp/chromedriver");

And it’s done. ChromeDriverInstaller detects the installed chrome version, download the compatible ChromeDriver, unarchive and set system property – webdriver.chrome.driver, on behalf of yourself.

In the case ChromeDriverInstaller is unable to detect Chrome, or unable to download the desired version of ChromeDriver, it will return Optional.empty().

Currently, ChromeDriverInstaller supports macOS and Linux. Assumes Chrome is located either /Applications/ or /usr/bin/ directory. If the behavior doesn’t suit your configuration, please feel free to send us pull requests.
GitHub Samuraism / chrome-driver-installer

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です