@@ -131,16 +131,54 @@ jobs:
131131 if : matrix.os == 'windows-latest'
132132 shell : pwsh
133133 run : |
134- # Tauri uses the WebView2 runtime, not Edge directly.
135- # msedgedriver must match the WebView2 runtime version, not the Edge browser version.
134+ # Tauri uses the WebView2 runtime, not Edge directly, so msedgedriver must be
135+ # compatible with the WebView2 runtime (matching the major version is sufficient).
136+ # Microsoft does not publish a driver for every exact runtime build, so try the
137+ # exact version first, then fall back to the latest driver for the same major
138+ # version, then LATEST_STABLE. This keeps the job from breaking whenever the
139+ # runner's WebView2 build outpaces the published Edge drivers.
140+ $ErrorActionPreference = 'Stop'
136141 $wv2Key = 'HKLM:\SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}'
137142 if (-not (Test-Path $wv2Key)) { $wv2Key = 'HKLM:\SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}' }
138143 $wv2Version = (Get-ItemProperty $wv2Key).pv
139- Write-Host "WebView2 runtime version: $wv2Version"
140- $driverUrl = "https://msedgewebdriverstorage.blob.core.windows.net/edgewebdriver/$wv2Version/edgedriver_win64.zip"
144+ $wv2Major = $wv2Version.Split('.')[0]
145+ Write-Host "WebView2 runtime version: $wv2Version (major $wv2Major)"
146+
147+ # Microsoft locked down the old msedgewebdriverstorage blob (now returns HTTP 409
148+ # "Public access is not permitted"); the current host is msedgedriver.microsoft.com.
149+ $base = "https://msedgedriver.microsoft.com"
150+
151+ # Ordered list of candidate driver versions to try.
152+ $candidates = [System.Collections.Generic.List[string]]::new()
153+ $candidates.Add($wv2Version)
154+ foreach ($marker in @("LATEST_RELEASE_${wv2Major}_WINDOWS", "LATEST_STABLE")) {
155+ try {
156+ $resolved = (Invoke-WebRequest -UseBasicParsing -Uri "$base/$marker").Content
157+ # Markers are UTF-16/BOM encoded; keep only version characters.
158+ $resolved = ($resolved -replace '[^0-9\.]', '').Trim()
159+ if ($resolved) { $candidates.Add($resolved); Write-Host "marker $marker -> $resolved" }
160+ } catch {
161+ Write-Host "marker $marker unavailable: $($_.Exception.Message)"
162+ }
163+ }
164+
141165 $zipPath = "$env:TEMP\edgedriver.zip"
142166 $extractDir = "$env:TEMP\edgedriver"
143- Invoke-WebRequest -Uri $driverUrl -OutFile $zipPath
167+ $ok = $false
168+ foreach ($v in ($candidates | Select-Object -Unique)) {
169+ $driverUrl = "$base/$v/edgedriver_win64.zip"
170+ Write-Host "Trying EdgeDriver $v -> $driverUrl"
171+ try {
172+ Invoke-WebRequest -UseBasicParsing -Uri $driverUrl -OutFile $zipPath
173+ Write-Host "Downloaded EdgeDriver $v"
174+ $ok = $true
175+ break
176+ } catch {
177+ Write-Host " not available: $($_.Exception.Message)"
178+ }
179+ }
180+ if (-not $ok) { throw "No compatible msedgedriver found for WebView2 $wv2Version (tried: $($candidates -join ', '))" }
181+
144182 Expand-Archive -Path $zipPath -DestinationPath $extractDir -Force
145183 $driverDir = "$extractDir\edgedriver_win64"
146184 if (-not (Test-Path "$driverDir\msedgedriver.exe")) { $driverDir = $extractDir }
0 commit comments