From 0d5a9ef0786fe824a47eecd8040203d0cb7f905a Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 8 Sep 2024 17:12:01 +0200 Subject: [PATCH] Update Selenium to the newest version --- scripts/Common/Scripts/BrowserAutomation.ps1 | 16 ++++------------ scripts/Common/Scripts/Operations.ps1 | 2 +- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/scripts/Common/Scripts/BrowserAutomation.ps1 b/scripts/Common/Scripts/BrowserAutomation.ps1 index 5fd68768..60e3a270 100644 --- a/scripts/Common/Scripts/BrowserAutomation.ps1 +++ b/scripts/Common/Scripts/BrowserAutomation.ps1 @@ -15,18 +15,10 @@ $null = New-Module { ) if (-not ("OpenQA.Selenium.Firefox.FirefoxDriver" -as [type])) { - $zipFile = [System.IO.Compression.ZipFile]::OpenRead((Get-Package Selenium.WebDriver).Source); - $webDriver = ($zipFile.Entries | Where-Object { $_.FullName -like "lib/net6.0/WebDriver.dll" })[0]; - $stream = [System.IO.MemoryStream]::new(); - $reader = [System.IO.StreamReader]($webDriver).Open(); - $reader.BaseStream.CopyTo($stream); - [byte[]]$bytes = $stream.ToArray(); - $reader.Close(); - $reader.Dispose(); - $stream.Close(); - $stream.Dispose(); - $zipFile.Dispose(); - $null = [System.Reflection.Assembly]::Load($bytes); + $packageRoot = Split-Path -Parent (Get-Package Selenium.WebDriver).Source; + $file = Join-Path $packageRoot "lib/netstandard2.0/WebDriver.dll"; + $env:SE_MANAGER_PATH = Join-Path $packageRoot "manager" ($IsWindows ? "windows" : "linux") "selenium-manager$($IsWindows ? ".exe" : '')"; + $null = [System.Reflection.Assembly]::LoadFile($file); } & $Action; diff --git a/scripts/Common/Scripts/Operations.ps1 b/scripts/Common/Scripts/Operations.ps1 index fce78bd6..e25b56f5 100644 --- a/scripts/Common/Scripts/Operations.ps1 +++ b/scripts/Common/Scripts/Operations.ps1 @@ -229,7 +229,7 @@ $null = New-Module { if (-not (Test-PSPackage Selenium.WebDriver)) { Write-Host "Installing browser automation tools…"; - $null = Install-Package -Force Selenium.WebDriver -RequiredVersion 4.10.0 -SkipDependencies; + $null = Install-Package -Force Selenium.WebDriver -RequiredVersion 4.24.0 -SkipDependencies; continue; }