2019-12-19 16:19:58 +03:00
|
|
|
################################################################################
|
|
|
|
|
## File: Install-Selenium.ps1
|
|
|
|
|
## Desc: Install Selenium Server standalone
|
|
|
|
|
################################################################################
|
|
|
|
|
|
2021-08-20 16:55:04 +03:00
|
|
|
# Create Selenium directory
|
2020-05-06 07:20:39 +03:00
|
|
|
$seleniumDirectory = "C:\selenium\"
|
|
|
|
|
New-Item -ItemType directory -Path $seleniumDirectory
|
|
|
|
|
|
2021-10-28 22:17:05 +03:00
|
|
|
# Download Selenium
|
|
|
|
|
$seleniumMajorVersion = (Get-ToolsetContent).selenium.version
|
2023-10-09 10:55:12 +02:00
|
|
|
|
2023-11-28 15:08:03 +01:00
|
|
|
$seleniumDownloadUrl = Resolve-GithubReleaseAssetUrl `
|
|
|
|
|
-Repo "SeleniumHQ/selenium" `
|
|
|
|
|
-Version "$seleniumMajorVersion.*" `
|
2023-12-11 11:59:52 +01:00
|
|
|
-Asset "selenium-server-*.jar" `
|
|
|
|
|
-AllowMultipleMatches
|
2021-08-20 16:55:04 +03:00
|
|
|
|
2023-11-29 13:02:29 +01:00
|
|
|
$seleniumBinPath = Join-Path $seleniumDirectory "selenium-server.jar"
|
|
|
|
|
Invoke-DownloadWithRetry -Url $seleniumDownloadUrl -Path $seleniumBinPath
|
2019-12-19 16:19:58 +03:00
|
|
|
|
2024-03-14 10:53:11 +01:00
|
|
|
# Create an empty file to retrieve Selenium version
|
2021-10-28 22:17:05 +03:00
|
|
|
$seleniumFullVersion = $seleniumDownloadUrl.Split("-")[1].Split("/")[0]
|
2023-11-28 15:08:03 +01:00
|
|
|
New-Item -Path $seleniumDirectory -Name "selenium-server-$seleniumFullVersion"
|
2021-10-28 22:17:05 +03:00
|
|
|
|
2021-08-20 16:55:04 +03:00
|
|
|
# Add SELENIUM_JAR_PATH environment variable
|
2023-11-17 13:52:52 +01:00
|
|
|
[Environment]::SetEnvironmentVariable("SELENIUM_JAR_PATH", $seleniumBinPath, "Machine")
|
2020-07-20 18:57:00 +03:00
|
|
|
|
2021-08-20 16:55:04 +03:00
|
|
|
Invoke-PesterTests -TestFile "Browsers" -TestName "Selenium"
|