From 537e9da92924cf17e3aec1171b9b407c1171ce0e Mon Sep 17 00:00:00 2001 From: Ivan Nosar Date: Thu, 19 Dec 2019 16:19:58 +0300 Subject: [PATCH] Install Selenium (draft) --- images/win/Windows2016-Azure.json | 6 ++++++ images/win/Windows2019-Azure.json | 6 ++++++ .../scripts/Installers/Install-Selenium.ps1 | 21 +++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 images/win/scripts/Installers/Install-Selenium.ps1 diff --git a/images/win/Windows2016-Azure.json b/images/win/Windows2016-Azure.json index c51dcdfe5..a0ceb902c 100644 --- a/images/win/Windows2016-Azure.json +++ b/images/win/Windows2016-Azure.json @@ -336,6 +336,12 @@ "{{ template_dir }}/scripts/Installers/Install-Firefox.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Selenium.ps1" + ] + }, { "type": "powershell", "scripts":[ diff --git a/images/win/Windows2019-Azure.json b/images/win/Windows2019-Azure.json index 6875b7f07..2424320ae 100644 --- a/images/win/Windows2019-Azure.json +++ b/images/win/Windows2019-Azure.json @@ -306,6 +306,12 @@ "{{ template_dir }}/scripts/Installers/Install-Firefox.ps1" ] }, + { + "type": "powershell", + "scripts":[ + "{{ template_dir }}/scripts/Installers/Install-Selenium.ps1" + ] + }, { "type": "powershell", "scripts":[ diff --git a/images/win/scripts/Installers/Install-Selenium.ps1 b/images/win/scripts/Installers/Install-Selenium.ps1 new file mode 100644 index 000000000..6dcb63ecc --- /dev/null +++ b/images/win/scripts/Installers/Install-Selenium.ps1 @@ -0,0 +1,21 @@ +################################################################################ +## File: Install-Selenium.ps1 +## Desc: Install Selenium Server standalone +################################################################################ + +# Acquire latest Selenium release number from GitHub API +$latestReleaseUrl = "https://api.github.com/repos/SeleniumHQ/selenium/releases/latest" +$latestReleaseInfo = Invoke-RestMethod -Uri $latestReleaseUrl +$seleniumVersionString = $latestReleaseInfo.name.Split(" ")[1] +$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" +$seleniumBinPath = "C:\selenium\selenium-server-standalone.jar" +Invoke-WebRequest -UseBasicParsing -Uri $seleniumReleaseUrl -OutFile $seleniumBinPath + +setx "CLASSPATH" "$($seleniumBinPath):$($env:CLASSPATH)" /M + +exit 0