Compare commits
2 commits
7c2023056d
...
aa9098c887
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | aa9098c887 | ||
Manuel Thalmann | b7391def41 |
|
@ -127,12 +127,16 @@ $null = New-Module {
|
|||
|
||||
.PARAMETER OutDir
|
||||
The directory to download the file to.
|
||||
|
||||
.PARAMETER Timeout
|
||||
The number of seconds to wait before clicking the download button.
|
||||
#>
|
||||
function Start-BrowserDownload {
|
||||
param(
|
||||
[string] $URL,
|
||||
[string] $ButtonSelector,
|
||||
[string] $OutDir = $null
|
||||
[string] $OutDir = $null,
|
||||
[double] $Timeout = 0
|
||||
)
|
||||
|
||||
Start-CustomBrowserDownload @PSBoundParameters -Action {
|
||||
|
@ -153,8 +157,12 @@ $null = New-Module {
|
|||
}
|
||||
}
|
||||
|
||||
if ($Timeout -gt 0) {
|
||||
Start-Sleep $Timeout;
|
||||
}
|
||||
|
||||
if ($element) {
|
||||
$Browser.FindElement([OpenQA.Selenium.By]::CssSelector($ButtonSelector)).Click();
|
||||
$Browser.FindElement($selector).Click();
|
||||
} else {
|
||||
Write-Error "Unable to find download button!";
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
-Installer {
|
||||
Write-Host "Downloading reWASD…";
|
||||
$dir = New-TemporaryDirectory;
|
||||
$file = Start-BrowserDownload -URL "https://rewasd.com/" -ButtonSelector 'a.btn-default[href="#"]' -OutDir $dir;
|
||||
$file = Start-BrowserDownload -URL "https://rewasd.com/" -ButtonSelector 'a.btn-default[href="#"]' -OutDir $dir -Timeout 1;
|
||||
|
||||
Write-Host "Installing reWASD…";
|
||||
Start-Process -Wait -FilePath $($file.FullName) -ArgumentList "/S";
|
||||
|
|
Loading…
Reference in a new issue