Getting chromedriver updates

Google Chrome Logo

What if you use chromedriver for Selenium Web testing of your application? When new version of Google Chrome is out, the developers gets frustrated why does their tests are made unstable again?

There was some level of compatibility between chrome and chromedriver versions: chromedrivers has support for three latest released. But I found this has changed recently. The chromedriver 2.46 release was the latest release with "last three releases" supports policy.

Now chromedriver and chrome versions are coincide in MAJOR.MINOR.PATCH triad. Fourth number may differ when patches for current version are become available.

There is new version selector guide which is explain how you can select right chromedriver version for your current chrome.

Here is excerpt:

Here are the steps to select the version of ChromeDriver to download:

This is painful for me to manually update chromedriver when I found that chrome version has changed. I'd like to automate this.

And here is powershell script I've wrote. The requirements was:

  • chromedriver.exe located in Selenium folder of my project (you can customize it with $chromeDriverRelativeDir variable)
  • script fetches chromedriver version from$chromeDriverExpectedVersion URL
    • $chromeDriverExpectedVersion is MAJOR.MINOR.PATCH version of current installed chrome
    • URL contains latest full version of chromedriver, I'll store it in $chromeDriverLatestVersion variable
  • script downloads chromedriver version from$chromeDriverLatestVersion/
  • script then unpacks contents of downloaded zip archive for inplace update of chromedriver executable
  • special handling used for chrome versions < 73 - use chromedriver v2.46
  • special handling used if no need to update existing chromedriver
$thisScriptRoot = if ($PSScriptRoot -eq "") { "." } else { $PSScriptRoot }

$chromeDriverRelativeDir = "Selenium"
$chromeDriverDir = $(Join-Path $thisScriptRoot $chromeDriverRelativeDir)
$chromeDriverFileLocation = $(Join-Path $chromeDriverDir "chromedriver.exe")
$chromeVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe").FileVersion
$chromeMajorVersion = $chromeVersion.split(".")[0]

if (-Not (Test-Path $chromeDriverDir -PathType Container)) {
  $dir = New-Item -ItemType directory -Path $chromeDriverDir

if (Test-Path $chromeDriverFileLocation -PathType Leaf) {
  # get version of current chromedriver.exe
  $chromeDriverFileVersion = (& $chromeDriverFileLocation --version)
  $chromeDriverFileVersionHasMatch = $chromeDriverFileVersion -match "ChromeDriver (\d+\.\d+\.\d+(\.\d+)?)"
  $chromeDriverCurrentVersion = $matches[1]

  if (-Not $chromeDriverFileVersionHasMatch) {
else {
  # if chromedriver.exe not found, will download it
  $chromeDriverCurrentVersion = ''

if ($chromeMajorVersion -lt 73) {
  # for chrome versions < 73 will use chromedriver v2.46 (which supports chrome v71-73)
  $chromeDriverExpectedVersion = "2.46"
  $chromeDriverVersionUrl = ""
else {
  $chromeDriverExpectedVersion = $chromeVersion.split(".")[0..2] -join "."
  $chromeDriverVersionUrl = "" + $chromeDriverExpectedVersion

$chromeDriverLatestVersion = Invoke-RestMethod -Uri $chromeDriverVersionUrl

Write-Output "chrome version:       $chromeVersion"
Write-Output "chromedriver version: $chromeDriverCurrentVersion"
Write-Output "chromedriver latest:  $chromeDriverLatestVersion"

$needUpdateChromeDriver = $chromeDriverCurrentVersion -ne $chromeDriverLatestVersion
if ($needUpdateChromeDriver) {
  $chromeDriverZipLink = "" + $chromeDriverLatestVersion + "/"
  Write-Output "Will download $chromeDriverZipLink"

  $chromeDriverZipFileLocation = $(Join-Path $chromeDriverDir "")

  Invoke-WebRequest -Uri $chromeDriverZipLink -OutFile $chromeDriverZipFileLocation
  Expand-Archive $chromeDriverZipFileLocation -DestinationPath $(Join-Path $thisScriptRoot $chromeDriverRelativeDir) -Force
  Remove-Item -Path $chromeDriverZipFileLocation -Force
  $chromeDriverFileVersion = (& $chromeDriverFileLocation --version)
  Write-Output "chromedriver updated to version $chromeDriverFileVersion"
else {
  Write-Output "chromedriver is actual"


I wrote powershell script which I could run in build agent right before selenium web tests. It will check current chrome version on build agent and will update chromedriver accordingly.

Happy selenium web testing!

liberapay link If you like this post, consider supporting me on liberapay