[how-to] workaround for chromium edge driver autoupdate not working

I have a workaround for this issue (chromium edge drivers do not download the appropriate version when using -webui.autoUpdateDrivers=true), and thought it might help others!

I wrote a powershell script that automates the update for you - it gets the current version of Chromium Edge on your system, downloads the driver from microsoft, and then adds it to the include/drivers folder in my Katalon project to override existing chromium edge drivers as per this specification.

I am running my tests on Azure DevOps Pipeline, but this could work for people running locally as well (you could execute this powershell script in a helper test before running your tests).

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$key = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{56EB18F8-B008-4CBD-B6D2-8C97FE7E9062}'
$version = (Get-ItemProperty -Path $key -Name pv).pv
$url = 'https://msedgedriver.azureedge.net/' + $version + '/edgedriver_win32.zip'
New-Item -Path "c:\" -Name "edgedriver" -ItemType "directory"
Invoke-WebRequest -Uri $url -OutFile c:\edgedriver\edgedriver_win32.zip
Expand-Archive -LiteralPath c:\edgedriver\edgedriver_win32.zip -DestinationPath c:\edgedriver\expanded\
$MyProjDir = Get-Item KATALON_PROJECT_NAME/Include/
New-Item -Path $MyProjDir -Name "drivers" -ItemType "directory"
New-Item -Path $MyProjDir/drivers -Name "edgechromiumdriver_win64" -ItemType "directory"
New-Item -Path $MyProjDir/drivers -Name "edgechromiumdriver_win32" -ItemType "directory"
Copy-Item -Path c:\edgedriver\expanded\msedgedriver.exe -Destination $MyProjDir/drivers/edgechromiumdriver_win64/
Copy-Item -Path c:\edgedriver\expanded\msedgedriver.exe -Destination $MyProjDir/drivers/edgechromiumdriver_win32/

Limitations of this script:

  • only for windows machines (but you can probably make a mac version if you feel like it…)
  • assumes a working directory of one above your existing project, adjust the $MyProjDir = Get-Item line as needed for your project location and project name.
  • relies on Microsoft maintaining the same URL formatting for downloads as exists currently on this page.
  • this script only gets the win32 driver since I think it works for both win32 and win64, but feel free to get/extract the win64 driver too if you want

If you have any questions let me know and I can try and help you.
Jeanie

4 Likes

Wow. Thanks Jeanie!

For a tips article, it would be better if you provided a bare-bones TC that did that.

Sure - I actually have a keyword that I wrote to execute shell/powershell scripts on mac/pc that I normally use - I’ll try to write that up later this week and I’ll reference that here at that time.

1 Like