mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
fix geckodriver output
This commit is contained in:
@@ -49,5 +49,5 @@ if ! command -v geckodriver; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Lastly, documenting what we added to the metadata file"
|
echo "Lastly, documenting what we added to the metadata file"
|
||||||
ver=`./geckodriver --version|head -1|awk '{print $2}'`
|
ver=`geckodriver --version | head -1 |awk '{print $2}'`
|
||||||
DocumentInstalledItem "Geckodriver (${ver}); Gecko Driver is available via GECKOWEBDRIVER environment variable"
|
DocumentInstalledItem "Geckodriver (${ver}); Gecko Driver is available via GECKOWEBDRIVER environment variable"
|
||||||
|
|||||||
@@ -56,4 +56,4 @@ if ! command -v chromedriver; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Lastly, documenting what we added to the metadata file"
|
echo "Lastly, documenting what we added to the metadata file"
|
||||||
DocumentInstalledItem "Chromedriver ($(chromedriver --version)); Chrome Driver is available via CHROMEWEBDRIVER environment variable"
|
DocumentInstalledItem "$(chromedriver --version); Chrome Driver is available via CHROMEWEBDRIVER environment variable"
|
||||||
|
|||||||
@@ -25,42 +25,3 @@ pref("app.update.enabled", false);' -ItemType file -force
|
|||||||
$firefoxPreferencesFolder = Join-Path $firefoxDirectoryPath "defaults\pref"
|
$firefoxPreferencesFolder = Join-Path $firefoxDirectoryPath "defaults\pref"
|
||||||
New-Item -path $firefoxPreferencesFolder -Name 'local-settings.js' -Value 'pref("general.config.obscure_value", 0);
|
New-Item -path $firefoxPreferencesFolder -Name 'local-settings.js' -Value 'pref("general.config.obscure_value", 0);
|
||||||
pref("general.config.filename", "mozilla.cfg");' -ItemType file -force
|
pref("general.config.filename", "mozilla.cfg");' -ItemType file -force
|
||||||
|
|
||||||
Write-Host "Install Firefox WebDriver"
|
|
||||||
|
|
||||||
$geckodriverJson = Invoke-RestMethod "https://api.github.com/repos/mozilla/geckodriver/releases/latest"
|
|
||||||
$geckodriverWindowsAsset = $geckodriverJson.assets | Where-Object { $_.name -Match "win64" } | Select-Object -First 1
|
|
||||||
|
|
||||||
Write-Host "Geckodriver version: $($geckodriverJson.tag_name)"
|
|
||||||
|
|
||||||
|
|
||||||
$DriversZipFile = $geckodriverWindowsAsset.name
|
|
||||||
Write-Host "Selenium drivers download and install..."
|
|
||||||
|
|
||||||
$FirefoxDriverPath = Join-Path $env:SystemDrive "SeleniumWebDrivers\GeckoDriver"
|
|
||||||
|
|
||||||
# Install Firefox Web Driver
|
|
||||||
Write-Host "FireFox driver download...."
|
|
||||||
if (-not (Test-Path -Path $FireFoxDriverPath)) {
|
|
||||||
New-Item -Path $FireFoxDriverPath -ItemType "directory"
|
|
||||||
}
|
|
||||||
|
|
||||||
$DestFile = Join-Path $FireFoxDriverPath $DriversZipFile
|
|
||||||
$FireFoxDriverDownloadUrl = $geckodriverWindowsAsset.browser_download_url
|
|
||||||
try{
|
|
||||||
Invoke-WebRequest -Uri $FireFoxDriverDownloadUrl -OutFile $DestFile
|
|
||||||
} catch {
|
|
||||||
Write-Error "[!] Failed to download $DriversZipFile"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "FireFox driver install...."
|
|
||||||
Expand-Archive -Path $DestFile -DestinationPath $FireFoxDriverPath -Force
|
|
||||||
Remove-Item -Path $DestFile -Force
|
|
||||||
|
|
||||||
|
|
||||||
Write-Host "Setting the environment variables"
|
|
||||||
Add-MachinePathItem -PathItem $FireFoxDriverPath
|
|
||||||
setx GeckoWebDriver "$FirefoxDriverPath" /M;
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
@@ -94,3 +94,44 @@ $PathValue += ";$EdgeDriverPath\";
|
|||||||
Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $PathValue;
|
Set-ItemProperty -Path $regEnvKey -Name 'Path' -Value $PathValue;
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
# Install Firefox gecko Web Driver
|
||||||
|
Write-Host "Install Firefox WebDriver"
|
||||||
|
|
||||||
|
$geckodriverJson = Invoke-RestMethod "https://api.github.com/repos/mozilla/geckodriver/releases/latest"
|
||||||
|
$geckodriverWindowsAsset = $geckodriverJson.assets | Where-Object { $_.name -Match "win64" } | Select-Object -First 1
|
||||||
|
|
||||||
|
$geckodriverVersion = $geckodriverJson.tag_name
|
||||||
|
Write-Host "Geckodriver version: $geckodriverVersion"
|
||||||
|
|
||||||
|
$DriversZipFile = $geckodriverWindowsAsset.name
|
||||||
|
Write-Host "Selenium drivers download and install..."
|
||||||
|
|
||||||
|
$FirefoxDriverPath = Join-Path $SeleniumWebDriverPath "GeckoDriver"
|
||||||
|
$geckodriverVersion.Substring(1) | Out-File -FilePath "$FirefoxDriverPath\versioninfo.txt" -Force;
|
||||||
|
|
||||||
|
# Install Firefox Web Driver
|
||||||
|
Write-Host "FireFox driver download...."
|
||||||
|
if (-not (Test-Path -Path $FireFoxDriverPath)) {
|
||||||
|
New-Item -Path $FireFoxDriverPath -ItemType "directory"
|
||||||
|
}
|
||||||
|
|
||||||
|
$DestFile = Join-Path $FireFoxDriverPath $DriversZipFile
|
||||||
|
$FireFoxDriverDownloadUrl = $geckodriverWindowsAsset.browser_download_url
|
||||||
|
try{
|
||||||
|
Invoke-WebRequest -Uri $FireFoxDriverDownloadUrl -OutFile $DestFile
|
||||||
|
} catch {
|
||||||
|
Write-Error "[!] Failed to download $DriversZipFile"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "FireFox driver install...."
|
||||||
|
Expand-Archive -Path $DestFile -DestinationPath $FireFoxDriverPath -Force
|
||||||
|
Remove-Item -Path $DestFile -Force
|
||||||
|
|
||||||
|
|
||||||
|
Write-Host "Setting the environment variables"
|
||||||
|
Add-MachinePathItem -PathItem $FireFoxDriverPath
|
||||||
|
setx GeckoWebDriver "$FirefoxDriverPath" /M;
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user