mirror of
https://github.com/actions/runner-images.git
synced 2025-12-15 22:26:56 +00:00
Install Microsoft Edge and related web drivers on Windows (#338)
Co-authored-by: MaksimZhukov <46996400+MaksimZhukov@users.noreply.github.com>
This commit is contained in:
@@ -354,6 +354,12 @@
|
||||
"{{ template_dir }}/scripts/Installers/Install-Chrome.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Install-Edge.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
@@ -655,6 +661,12 @@
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Chrome.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Edge.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
|
||||
@@ -323,6 +323,12 @@
|
||||
"{{ template_dir }}/scripts/Installers/Install-Chrome.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Install-Edge.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
@@ -624,6 +630,12 @@
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Chrome.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Validate-Edge.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
|
||||
6
images/win/scripts/Installers/Install-Edge.ps1
Normal file
6
images/win/scripts/Installers/Install-Edge.ps1
Normal file
@@ -0,0 +1,6 @@
|
||||
################################################################################
|
||||
## File: Install-Edge.ps1
|
||||
## Desc: Install latest stable version of Microsoft Edge browser
|
||||
################################################################################
|
||||
|
||||
choco install microsoft-edge -y
|
||||
@@ -21,7 +21,9 @@ $ChromeDriverPath = "$DestinationPath\SeleniumWebDrivers\ChromeDriver";
|
||||
Write-Host "Chrome driver path: [$ChromeDriverPath]";
|
||||
Remove-Item -Path "$ChromeDriverPath\*" -Force;
|
||||
|
||||
$ChromePath = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe').'(default)';
|
||||
# Reinstall Chrome Web Driver
|
||||
$RegistryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths"
|
||||
$ChromePath = (Get-ItemProperty "$RegistryPath\chrome.exe").'(default)';
|
||||
[version]$ChromeVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($ChromePath).ProductVersion;
|
||||
Write-Host "Chrome version: [$ChromeVersion]";
|
||||
|
||||
@@ -44,16 +46,39 @@ Write-Host "Chrome driver install....";
|
||||
Expand-Archive -Path "$ChromeDriverPath\chromedriver_win32.zip" -DestinationPath $ChromeDriverPath -Force;
|
||||
Remove-Item -Path "$ChromeDriverPath\chromedriver_win32.zip" -Force;
|
||||
|
||||
Write-Host "Setting the environment variables";
|
||||
# Install Microsoft Edge Web Driver
|
||||
Write-Host "Microsoft Edge driver download...."
|
||||
$EdgeDriverPath = "$DestinationPath\SeleniumWebDrivers\EdgeDriver"
|
||||
if (-not (Test-Path -Path $EdgeDriverPath)) {
|
||||
New-Item -Path $EdgeDriverPath -ItemType "directory"
|
||||
}
|
||||
|
||||
$EdgePath = (Get-ItemProperty "$RegistryPath\msedge.exe").'(default)'
|
||||
[version]$EdgeVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($EdgePath).ProductVersion
|
||||
$EdgeDriverVersionUrl = "https://msedgedriver.azureedge.net/LATEST_RELEASE_$($EdgeVersion.Major)"
|
||||
$EdgeDriverVersionFile = "$EdgeDriverPath\versioninfo.txt"
|
||||
Invoke-WebRequest -Uri $EdgeDriverVersionUrl -OutFile $EdgeDriverVersionFile
|
||||
|
||||
$EdgeDriverLatestVersion = Get-Content -Path $EdgeDriverVersionFile
|
||||
$EdgeDriverDownloadUrl="https://msedgedriver.azureedge.net/${EdgeDriverLatestVersion}/edgedriver_win64.zip"
|
||||
$DestFile = "$EdgeDriverPath\edgedriver_win64.zip"
|
||||
Invoke-WebRequest -Uri $EdgeDriverDownloadUrl -OutFile $DestFile
|
||||
|
||||
Write-Host "Microsoft Edge driver install...."
|
||||
Expand-Archive -Path $DestFile -DestinationPath $EdgeDriverPath -Force
|
||||
Remove-Item -Path $DestFile -Force
|
||||
|
||||
Write-Host "Setting the environment variables"
|
||||
|
||||
setx IEWebDriver "C:\SeleniumWebDrivers\IEDriver" /M;
|
||||
setx GeckoWebDriver "C:\SeleniumWebDrivers\GeckoDriver" /M;
|
||||
setx ChromeWebDriver "C:\SeleniumWebDrivers\ChromeDriver" /M;
|
||||
setx ChromeWebDriver "$ChromeDriverPath" /M;
|
||||
setx EdgeWebDriver "$EdgeDriverPath" /M;
|
||||
|
||||
$regEnvKey = 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\';
|
||||
$PathValue = Get-ItemPropertyValue -Path $regEnvKey -Name 'Path';
|
||||
$PathValue += ";C:\SeleniumWebDrivers\ChromeDriver\";
|
||||
$PathValue += ";$ChromeDriverPath\";
|
||||
$PathValue += ";$EdgeDriverPath\";
|
||||
Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $PathValue;
|
||||
|
||||
exit 0;
|
||||
|
||||
|
||||
25
images/win/scripts/Installers/Validate-Edge.ps1
Normal file
25
images/win/scripts/Installers/Validate-Edge.ps1
Normal file
@@ -0,0 +1,25 @@
|
||||
################################################################################
|
||||
## File: Validate-Edge.ps1
|
||||
## Desc: Validate Microsoft Edge installation.
|
||||
################################################################################
|
||||
|
||||
$RegistryKey = "HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe"
|
||||
if (Test-Path $RegistryKey)
|
||||
{
|
||||
$SoftwareName = "Microsoft Edge"
|
||||
$VersionInfo = (Get-Item (Get-ItemProperty $RegistryKey).'(Default)').VersionInfo
|
||||
$VersionInfo
|
||||
$Description = @"
|
||||
_version:_
|
||||
$($VersionInfo.FileVersion)
|
||||
"@
|
||||
|
||||
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
|
||||
|
||||
exit 0
|
||||
}
|
||||
else
|
||||
{
|
||||
Write-Host "Microsoft Edge is not installed."
|
||||
exit 1
|
||||
}
|
||||
@@ -6,24 +6,36 @@
|
||||
$IEDriverPath = $env:IEWebDriver
|
||||
$GeckoDriverPath = $env:GeckoWebDriver
|
||||
$ChromeDriverPath = $env:ChromeWebDriver
|
||||
$EdgeDriverPath = $env:EdgeWebDriver
|
||||
|
||||
if (
|
||||
($IEDriverPath -like "C:\SeleniumWebDrivers\IEDriver") -and
|
||||
($GeckoDriverPath -like "C:\SeleniumWebDrivers\GeckoDriver") -and
|
||||
($ChromeDriverPath -like "C:\SeleniumWebDrivers\ChromeDriver") -and
|
||||
($EdgeDriverPath -like "C:\SeleniumWebDrivers\EdgeDriver")
|
||||
)
|
||||
{
|
||||
|
||||
if(($IEDriverPath -like "C:\SeleniumWebDrivers\IEDriver") -and ($GeckoDriverPath -like "C:\SeleniumWebDrivers\GeckoDriver") -and ($ChromeDriverPath -like "C:\SeleniumWebDrivers\ChromeDriver"))
|
||||
{
|
||||
|
||||
Write-Host "IEDriver installed at "
|
||||
(Get-Item "C:\SeleniumWebDrivers\IEDriver\IEDriverServer.exe").VersionInfo
|
||||
|
||||
|
||||
(Get-Item "$IEDriverPath\IEDriverServer.exe").VersionInfo
|
||||
|
||||
|
||||
Write-Host "Gecko Driver installed at "
|
||||
(Get-Item "C:\SeleniumWebDrivers\GeckoDriver\geckodriver.exe").VersionInfo
|
||||
|
||||
|
||||
(Get-Item "$GeckoDriverPath\geckodriver.exe").VersionInfo
|
||||
|
||||
|
||||
Write-Host "Chrome Driver installed at "
|
||||
(Get-Item "C:\SeleniumWebDrivers\ChromeDriver\chromedriver.exe").VersionInfo
|
||||
|
||||
$chromedriverversion = Get-Content -Path "C:\SeleniumWebDrivers\ChromeDriver\versioninfo.txt"
|
||||
$geckodriverversion = Get-Content -Path "C:\SeleniumWebDrivers\GeckoDriver\versioninfo.txt"
|
||||
$iedriverversion = Get-Content -Path "C:\SeleniumWebDrivers\IEDriver\versioninfo.txt"
|
||||
(Get-Item "$ChromeDriverPath\chromedriver.exe").VersionInfo
|
||||
|
||||
|
||||
Write-Host "Edge Driver installed at "
|
||||
(Get-Item "$EdgeDriverPath\msedgedriver.exe").VersionInfo
|
||||
|
||||
$versionFileName = "versioninfo.txt";
|
||||
$chromedriverversion = Get-Content -Path "$IEDriverPath\$versionFileName"
|
||||
$geckodriverversion = Get-Content -Path "$GeckoDriverPath\$versionFileName"
|
||||
$iedriverversion = Get-Content -Path "$ChromeDriverPath\$versionFileName"
|
||||
$edgedriverversion = Get-Content -Path "$EdgeDriverPath\$versionFileName"
|
||||
|
||||
# Adding description of the software to Markdown
|
||||
$SoftwareName = "Selenium Web Drivers"
|
||||
@@ -54,10 +66,18 @@ $iedriverversion
|
||||
_Environment:_
|
||||
* IEWebDriver: location of IEDriverServer.exe
|
||||
|
||||
#### Microsoft Edge Driver
|
||||
|
||||
_version:_
|
||||
$edgedriverversion
|
||||
|
||||
_Environment:_
|
||||
* EdgeWebDriver: location of msedgedriver.exe
|
||||
|
||||
"@
|
||||
|
||||
Add-SoftwareDetailsToMarkdown -SoftwareName $SoftwareName -DescriptionMarkdown $Description
|
||||
|
||||
|
||||
exit 0
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user