mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
[Windows] Rework Selenium installation (#4309)
This commit is contained in:
committed by
GitHub
parent
7d905024ff
commit
1b3870ab40
@@ -5,17 +5,21 @@
|
||||
|
||||
# Create Selenium directory
|
||||
$seleniumDirectory = "C:\selenium\"
|
||||
$seleniumFileName = "selenium-server-standalone.jar"
|
||||
|
||||
New-Item -ItemType directory -Path $seleniumDirectory
|
||||
|
||||
# Temporarily download Selenium 3.141.59, since 4.* can contain some breaking changes
|
||||
#$url = "https://api.github.com/repos/SeleniumHQ/selenium/releases"
|
||||
#[System.String] $seleniumReleaseUrl = (Invoke-RestMethod -Uri $url).assets.browser_download_url -match "selenium-server-standalone-.+.jar"
|
||||
# Download Selenium
|
||||
$seleniumMajorVersion = (Get-ToolsetContent).selenium.version
|
||||
$seleniumBinaryName = (Get-ToolsetContent).selenium.binary_name
|
||||
$seleniumFileName = "$seleniumBinaryName.jar"
|
||||
$json = Invoke-RestMethod -Uri "https://api.github.com/repos/SeleniumHQ/selenium/releases?per_page=100"
|
||||
$seleniumDownloadUrl = $json.Where{-not $_.prerelease}.assets.browser_download_url | Where-Object { $_ -like "*${seleniumBinaryName}-${seleniumMajorVersion}.*jar" } | Select-Object -First 1
|
||||
|
||||
$seleniumDownloadUrl = "https://github.com/SeleniumHQ/selenium/releases/download/selenium-3.141.59/selenium-server-standalone-3.141.59.jar"
|
||||
Start-DownloadWithRetry -Url $seleniumDownloadUrl -Name $seleniumFileName -DownloadPath $seleniumDirectory
|
||||
|
||||
# Create an epmty file to retrive selenium version
|
||||
$seleniumFullVersion = $seleniumDownloadUrl.Split("-")[1].Split("/")[0]
|
||||
New-Item -Path $seleniumDirectory -Name "$seleniumBinaryName-$seleniumFullVersion"
|
||||
|
||||
# Add SELENIUM_JAR_PATH environment variable
|
||||
$seleniumBinPath = Join-Path $seleniumDirectory $seleniumFileName
|
||||
setx "SELENIUM_JAR_PATH" "$($seleniumBinPath)" /M
|
||||
|
||||
Reference in New Issue
Block a user