mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
win/selenium: Download selenium-server-standalone.jar from GitHub (#3940)
This commit is contained in:
committed by
GitHub
parent
c81312dfa7
commit
20584a4394
@@ -3,31 +3,19 @@
|
||||
## Desc: Install Selenium Server standalone
|
||||
################################################################################
|
||||
|
||||
# Acquire latest Selenium release number from GitHub API
|
||||
$latestReleaseUrl = "https://api.github.com/repos/SeleniumHQ/selenium/releases/latest"
|
||||
try {
|
||||
$latestReleaseInfo = Invoke-RestMethod -Uri $latestReleaseUrl
|
||||
} catch {
|
||||
Write-Error $_
|
||||
exit 1
|
||||
}
|
||||
Write-Debug $latestReleaseInfo
|
||||
$seleniumVersionString = $latestReleaseInfo.name.Split(" ")[1]
|
||||
Write-Debug $seleniumVersionString
|
||||
$seleniumVersion = [version]::Parse($seleniumVersionString)
|
||||
|
||||
# Download Selenium
|
||||
Write-Host "Downloading selenium-server-standalone v$seleniumVersion..."
|
||||
|
||||
$seleniumReleaseUrl = "https://selenium-release.storage.googleapis.com/$($seleniumVersion.ToString(2))/selenium-server-standalone-$($seleniumVersion.ToString(3)).jar"
|
||||
# Create Selenium directory
|
||||
$seleniumDirectory = "C:\selenium\"
|
||||
$seleniumFileName = "selenium-server-standalone.jar"
|
||||
|
||||
New-Item -ItemType directory -Path $seleniumDirectory
|
||||
|
||||
# Download Selenium
|
||||
$url = "https://api.github.com/repos/SeleniumHQ/selenium/releases/latest"
|
||||
[System.String] $seleniumReleaseUrl = (Invoke-RestMethod -Uri $url).assets.browser_download_url -match "selenium-server-standalone-.+.jar"
|
||||
|
||||
Start-DownloadWithRetry -Url $seleniumReleaseUrl -Name $seleniumFileName -DownloadPath $seleniumDirectory
|
||||
|
||||
Write-Host "Add selenium jar to the environment variables..."
|
||||
# Add SELENIUM_JAR_PATH environment variable
|
||||
$seleniumBinPath = Join-Path $seleniumDirectory $seleniumFileName
|
||||
setx "SELENIUM_JAR_PATH" "$($seleniumBinPath)" /M
|
||||
|
||||
|
||||
Reference in New Issue
Block a user