2020-03-06 13:33:25 +03:00
|
|
|
################################################################################
|
|
|
|
|
## File: Install-SeleniumWebDrivers.ps1
|
|
|
|
|
## Desc: Install Selenium Web Drivers
|
|
|
|
|
################################################################################
|
2020-05-13 08:02:08 +03:00
|
|
|
$DestinationPath = "$($env:SystemDrive)\"
|
2020-03-06 13:33:25 +03:00
|
|
|
$DriversZipFile = "SeleniumWebDrivers.zip"
|
2020-05-13 08:02:08 +03:00
|
|
|
Write-Host "Destination path: [$DestinationPath]"
|
|
|
|
|
Write-Host "Selenium drivers download and install..."
|
2020-03-06 13:33:25 +03:00
|
|
|
try {
|
2020-05-13 08:02:08 +03:00
|
|
|
Invoke-WebRequest -UseBasicParsing -Uri "https://seleniumwebdrivers.blob.core.windows.net/seleniumwebdrivers/${DriversZipFile}" -OutFile $DriversZipFile
|
2020-03-06 13:33:25 +03:00
|
|
|
}
|
|
|
|
|
catch {
|
2020-05-13 08:02:08 +03:00
|
|
|
Write-Error "[!] Failed to download $DriversZipFile"
|
|
|
|
|
exit 1
|
2020-03-06 13:33:25 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$TempSeleniumDir = Join-Path $Env:TEMP "SeleniumWebDrivers"
|
2020-05-13 08:02:08 +03:00
|
|
|
Extract-7Zip -Path $DriversZipFile -DestinationPath $Env:TEMP
|
|
|
|
|
Remove-Item $DriversZipFile
|
2020-03-06 13:33:25 +03:00
|
|
|
|
|
|
|
|
$SeleniumWebDriverPath = Join-Path $DestinationPath "SeleniumWebDrivers"
|
|
|
|
|
$IEDriverPathTemp = Join-Path $TempSeleniumDir 'IEDriver'
|
|
|
|
|
|
|
|
|
|
if (-not (Test-Path -Path $SeleniumWebDriverPath)) {
|
|
|
|
|
New-Item -Path $SeleniumWebDriverPath -ItemType "directory"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Move-Item -Path "$IEDriverPathTemp" -Destination $SeleniumWebDriverPath
|
|
|
|
|
|
|
|
|
|
Write-Host "Setting the environment variables"
|
|
|
|
|
|
2020-05-13 08:02:08 +03:00
|
|
|
setx IEWebDriver "C:\SeleniumWebDrivers\IEDriver" /M
|